Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2012
    Posts
    3

    Smile Unanswered: Help with my constraints and pkey thnx

    is there a problem with my codes?

    btw im using Microsoft SQL Server 2008

    create table CUSTOMER (
    cus_code int IDENTITY (10001, 1) not null ,
    cus_company varchar(50),
    cus_lname varchar(50),
    cus_fname varchar(30),
    cus_iname varchar(30),
    cus_contact varchar(15),
    cus_address varchar (100),
    cus_balance int,
    constraint PK_Cus primary key(cus_code))

    Create table Vendor(
    v_code int,
    v_name varchar(50),
    v_contact varchar(50),
    v_address varchar(50),
    constraint PK_Vend primary key(v_code))

    Create table PRODUCT(
    prod_code varchar(10),
    prod_descript varchar(50),
    prod_indate varchar(50),
    prod_price float ,
    prod_discount float,
    prod_qty int,
    prod_sloc varchar(4),
    v_code int,
    constraint PK_Prod primary key(prod_code),
    constraint FK_Vend foreign key(v_code) references VENDOR
    )

    create table MSO(
    mso_number varchar(7) not null,
    cus_code int,
    mso_date varchar(15),
    constraint FK_MSOCus foreign key(cus_code) references CUSTOMER,
    constraint PK_Mso primary key(mso_number)
    )


    create table SalesInvoice(
    inv_number varchar(7) not null,
    cus_code int,
    mso_date varchar(15),
    constraint FK_SalesCus foreign key(cus_code) references CUSTOMER,
    constraint PK_Sales primary key(inv_number)
    )


    create table MSOLINE(
    mso_number varchar(7),
    msoline_number int,
    prod_code varchar(10),
    line_units float,
    line_price float,
    constraint PK_MsoLine primary key(msoline_number, mso_number),
    constraint FK_Mso foreign key(mso_number) references MSO,
    constraint FK_MSOProd foreign key(prod_code) references PRODUCT
    )


    create table InvoiceLine(
    inv_number varchar(7),
    invline_number int,
    prod_code varchar(10),
    line_units float,
    line_price float,
    constraint PK_InvLine primary key(invline_number, inv_number),
    constraint FK_Inv foreign key(inv_number) references SalesInvoice,
    constraint FK_InvProd foreign key(prod_code) references PRODUCT
    )
    thnx for the help
    Last edited by kyutkris; 03-28-12 at 10:46.

  2. #2
    Join Date
    Mar 2012
    Posts
    3
    is there something wrong with my constraints???

  3. #3
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    is there a problem with my codes?
    is there something wrong with my constraints???
    Did you get error messages?
    If so, can you post the messages?
    If not, why do you ask?
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

  4. #4
    Join Date
    Mar 2012
    Posts
    3
    Did you get error messages?
    If so, can you post the messages?
    If not, why do you ask?
    actually i dont get errors but im not sure with my constraints thnx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •