How to Create a Table In SQL Server Management Studio

One of the most basic functions in SQL Server Management Studio is creating a table for your database.  Below, I have displayed a piece of sample code that you can copy & paste, then customize to create your own table in SQL Server Management Studio.

Create Table Sample

– Create Table is the syntax used to make your table. Sample is the database name.
(

Dateid int NOT NULL Primary Key identity(1,1),
–Dateid is the column name.  int declares the data type (integer), not null tells the database not to accept entries without data, Primary Key makes this column the table’s primary Key and identity tells the database to automatically name each row starting with 1 and moving ID’s up in increments of 1.
month int NOT NULL constraint CK_zeroTOtwelve Check(month > 0 AND 12 > month),
– note the constraint created here… it tells SQL Server to only allow numbers between 1 and 12 into the database.

date int NOT NULL constraint CK_zeroTOthirty Check(date > 0 AND 31 > DATE),
hour int NOT NULL constraint CK_zeroTOtwentyfour Check(hour > 0 and 25 > hour)
)

SQL Server Management Studio has many other options when you create a table, but these are some of the basics and should get you started.

DIGG! STUMBLE! FACEBOOK! DELICOUS! TWITTER!- Share post below!
  • Digg
  • StumbleUpon
  • Facebook
  • del.icio.us
  • TwitThis

How to Insert Data into a Table In SQL Server Management Studio
MediaTemple Dedicated Virtual Server
Blog Issues
New Blog Feature: Live Chat!
Coolest Video Ever
Finally: A Good Night’s Sleep
Financial Risk Management Article
How To Build A Basic Online Reputation
How Hot Are You?
Average Big 3 Automanufacturer Worker Earns $70/ hour
Dating is Sales
TVI Coming Together
POSTED BY Joel on Nov 30 under Uncategorized

Leave a Reply

Copyright Best Online Marketing Blog – Joel Gross | Powered by Joel