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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.