Skip to main content

SQL Script to Create Tables

Continued from previous post “SQL Script to Create Database

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N' [dbo].[Product] ' ) AND type in (N'U'))
BEGIN
CREATE TABLE
[dbo].[Product](
    [ProductID] [int] PRIMARY KEY IDENTITY(1,1) NOT NULL,
    [Name] [varchar](50) NULL,
    [Description] [varchar](100) NULL,
    [Modified] [timestamp] NOT NULL
)
END
GO

SET IDENTITY_INSERT [dbo].[Product] ON
INSERT
[dbo].[Product] ([ProductID], [Name], [Description]) VALUES (1, N'Red Bull', N'This drink gives you wings.')
INSERT [dbo].[Product] ([ProductID], [Name], [Description]) VALUES (2, N'Orange Juice', N'This drink goes better with Red Bull.')
INSERT [dbo].[Product] ([ProductID], [Name], [Description]) VALUES (3, N'BBQ Chicken', N 'Yummy chicken for your tummy.')
INSERT [dbo].[Product] ([ProductID], [Name], [Description]) VALUES (4, N'Oreos', N'Cookie sandwiches with chocolate and cream.')
INSERT [dbo].[Product] ([ProductID], [Name], [Description]) VALUES (5, N'Apples', N'From Washington’)
SET IDENTITY_INSERT [dbo].[Product] OFF

Comments

Unknown said…
Better Work...
Put some more
:)
all d best Chinthaka...