dbTalk Databases Forums  

how to set composite key as foreign key?

comp.databases.theory comp.databases.theory


Discuss how to set composite key as foreign key? in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
rupali007
 
Posts: n/a

Default how to set composite key as foreign key? - 09-07-2003 , 01:27 AM







hi freinds,



i want to set any composite primary key in given table as foreigen key
by sql query not by enterprise manager.



suppose i have library as databse and two tables as

books(cAccnumber,ctitle,cedition)

issuedetails(cAccnumber,cMembercode,dDateofissue)



wher cAccnmuber is primary key in books and cAccnumber,cMembercode as
composite primary key in issuedetails.so if i want set cAccnumber as
foreign key then what will be query structure.



this is possible using enterprise manager but i want to do it by code.so
help me if u have any idea.



thanks


--
Posted via http://dbforums.com

Reply With Quote
  #2  
Old   
Bob Badour
 
Posts: n/a

Default Re: how to set composite key as foreign key? - 09-07-2003 , 06:06 AM






You don't mention the product you are using. Regardless, I suggest you open
the manual and look for "ALTER TABLE".

"rupali007" <member38432 (AT) dbforums (DOT) com> wrote

Quote:
hi freinds,



i want to set any composite primary key in given table as foreigen key
by sql query not by enterprise manager.



suppose i have library as databse and two tables as

books(cAccnumber,ctitle,cedition)

issuedetails(cAccnumber,cMembercode,dDateofissue)



wher cAccnmuber is primary key in books and cAccnumber,cMembercode as
composite primary key in issuedetails.so if i want set cAccnumber as
foreign key then what will be query structure.



this is possible using enterprise manager but i want to do it by code.so
help me if u have any idea.



thanks


--
Posted via http://dbforums.com



Reply With Quote
  #3  
Old   
rupali007
 
Posts: n/a

Default Re: how to set composite key as foreign key? - 09-07-2003 , 09:38 AM




i am using sql server 2000.i know about alter table but if u can wrtite
query and display to me it will be good for me. as i know the formate of
alter table but for composite primary key i am not able to do it.







Originally posted by Bob Badour

Quote:



You don't mention the product you are using. Regardless, I suggest
you open

the manual and look for "ALTER TABLE".



"rupali007" <member38432 (AT) dbforums (DOT) com> wrote in message

news:3339785.1062916039 (AT) dbforums (DOT) com"]news:3339785.1062916039@d-
bforums.com[/url]...

hi freinds,

i want to set any composite primary key in given table as
foreigen key

by sql query not by enterprise manager.

suppose i have library as databse and two tables as

books(cAccnumber,ctitle,cedition)

issuedetails(cAccnumber,cMembercode,dDateofissue)

wher cAccnmuber is primary key in books and
cAccnumber,cMembercode as

composite primary key in issuedetails.so if i want set
cAccnumber as

foreign key then what will be query structure.

this is possible using enterprise manager but i want to do it by
code.so

help me if u have any idea.

thanks

--

Posted via
http://dbforums.com/http://dbforums.com



--
Posted via http://dbforums.com


Reply With Quote
  #4  
Old   
Anith Sen
 
Posts: n/a

Default Re: how to set composite key as foreign key? - 09-08-2003 , 11:35 AM



Quote:
i am using sql server 2000....
Try
comp.databases.ms-sqlserver
or
microsoft.public.sqlserver.*

--
- Anith
( Please reply to newsgroups only )




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.