11 November, 2011
0 Comments
1 category
Just a simple example of creating a table by using T-SQL:
if not exists(select 1 from sys.objects where object_id = object_id(‘Product’))
begin
create table [dbo].[Product]
(
[Id] [int] not null identity (1, 1),
[Code] [nvarchar] (max) not null,
[ManufacturerId] [int] not null,
constraint [PK_Product_Id] primary key (Id),
constraint [FK_Manufacturer_ManufacturerId] foreign key ([ManufacturerId]) references [dbo].[Manufacturer] ([Id])
) on [primary]
end
Tags: T-SQL
Category: Uncategorized