Results 1 to 4 of 4

Thread: SQL CREATE TABLE

  1. #1

    Thread Starter
    Addicted Member Geoff Gunson's Avatar
    Join Date
    Jun 1999
    Posts
    241

    Post

    Hi

    I have the code to create a table dynamically but I need to know how to link a feild in one table to another table. I think I need to use the REFERENCES part but I have no idea how it works.

    Also does any body know of a good reference manual / book for SQL (so I don't bother U lot as much! )


    Cheers Guys and Gals

    Geoff

    ------------------

  2. #2
    New Member
    Join Date
    Jan 1999
    Location
    Cleveland,Ohio,USA
    Posts
    6

    Post

    You can do it like this:
    Dim NewRelation As Relation
    Set NewRelation = db.CreateRelation("ReferralContactsTransactions", _
    "ReferralContacts", "Transactions", dbRelationDontEnforce)
    NewRelation.Fields.Append NewRelation.CreateField("RefContactID")
    NewRelation.Fields("RefContactID").ForeignName = "RefContactID"
    db.Relations.Append NewRelation

  3. #3
    Junior Member
    Join Date
    Jul 1999
    Posts
    25

    Post

    Hi Geoff

    You should determine references while creating a table.

    CREATE TABLE "dbo"."TableX" (
    "Id" "int" IDENTITY (1, 1) NOT NULL ,
    "StringValue" varchar (20) NOT NULL ,
    ) REFERENCES "dbo"."Join" (
    "Join_Id"
    )
    )
    GO

  4. #4
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    I have this document beside my desk:
    http://w3.one.net/~jhoffman/sqltut.htm

Posting Permissions

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



Click Here to Expand Forum to Full Width