Need help to create table on given Data model diagram

  • Hi All,

    I never created table on the basis of Data model diagram .

    I have to create the 3 table on the basis of given Data model diagram.

    there are 3 tables

    1.md_geographyleveltype

    2.md_geographylevel

    3.md_geographylevelxref

    I have tried to create 2 table but unable to create 3rd table.

    requesting you all to kindly review the script of first 2 table and help me to create table script for 3rd table.

    Thanks in Advance

    Regards,

    Vipin jha

  • vipin_jha123 (7/27/2015)


    Hi All,

    I never created table on the basis of Data model diagram .

    I have to create the 3 table on the basis of given Data model diagram.

    there are 3 tables

    1.md_geographyleveltype

    2.md_geographylevel

    3.md_geographylevelxref

    I have tried to create 2 table but unable to create 3rd table.

    requesting you all to kindly review the script of first 2 table and help me to create table script for 3rd table.

    Thanks in Advance

    Regards,

    Vipin jha

    I see no script.

    Please tell us what the error is.


  • CREATE TABLE [dbo].[md_geographylevel](

    [type_key] [int] NOT NULL,

    [geog_key] [int] NOT NULL,

    [Type_description] [nvarchar](50) NULL,

    [Store_flag] [nvarchar](10) NULL,

    [Type_short_desciption] [nvarchar](50) NULL,

    [Type_long_desciption] [nvarchar](100) NULL,

    PRIMARY KEY CLUSTERED

    (

    [type_key] ASC,

    [geog_key] ASC

    )

    CREATE TABLE [dbo].[md_geographyleveltype](

    [type_key] [int] NOT NULL,

    [Type_description] [nvarchar](50) NULL,

    [Store_flag] [nvarchar](10) NULL,

    [Type_short_desciption] [nvarchar](50) NULL,

    [Type_long_desciption] [nvarchar](100) NULL,

    PRIMARY KEY CLUSTERED

    (

    [type_key] ASC

    )

    Kindly review bthe above table script as per data model diagram

    I am getting difficulties to create table script for table md_geographylevelxref

    help me to create the table create script for md_geographylevelxref

    regards,

    Vipin jha

  • vipin_jha123 (7/27/2015)


    CREATE TABLE [dbo].[md_geographylevel](

    [type_key] [int] NOT NULL,

    [geog_key] [int] NOT NULL,

    [Type_description] [nvarchar](50) NULL,

    [Store_flag] [nvarchar](10) NULL,

    [Type_short_desciption] [nvarchar](50) NULL,

    [Type_long_desciption] [nvarchar](100) NULL,

    PRIMARY KEY CLUSTERED

    (

    [type_key] ASC,

    [geog_key] ASC

    )

    CREATE TABLE [dbo].[md_geographyleveltype](

    [type_key] [int] NOT NULL,

    [Type_description] [nvarchar](50) NULL,

    [Store_flag] [nvarchar](10) NULL,

    [Type_short_desciption] [nvarchar](50) NULL,

    [Type_long_desciption] [nvarchar](100) NULL,

    PRIMARY KEY CLUSTERED

    (

    [type_key] ASC

    )

    Kindly review bthe above table script as per data model diagram

    I am getting difficulties to create table script for table md_geographylevelxref

    help me to create the table create script for md_geographylevelxref

    regards,

    Vipin jha

    What sort of 'difficulties'?

    Once again: please post the error message.

    It's quite difficult to help you with the things that are going wrong if you post only the details of what is going right.


  • Hi ,

    I am unable to start to create the script for 3rd table, it has multiple foreign key.

    kindly review the script of first 2 table and help me create the script for 3rd table.

    Regards,

    Vipin jha

  • Create the table as usual, then add the FKs using ALTER TABLE:

    alter table MyTable

    add constraint MyTable_MyColumn_FK FOREIGN KEY ( MyColumn ) references MyOtherTable(PKColumn)


Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply