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.