To insert data into a table in SQL Server Management Studio, you can use the following sample insert code.‚ I have included my notes on how the functions work using comments prefaced by — in the SQL.
–I have created a simple table for us to work with below:
create table Calendar
(
dateid int NOT NULL Primary Key identity(1,1),
month int NOT NULL constraint CK_zeroTOtwelve Check(month > 0 AND 12 > month),
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)
)
–The actual code for inserting data into the Calendar table we created above is as follow:
insert into calendar
(month, date, hour) –state which columns are going to be inserted into.‚ … read more “How to Insert Data into a Table In SQL Server Management Studio”