Discussion:
how to set composite key as foreign key?
(too old to reply)
rupali007
2003-09-07 06:27:19 UTC
Permalink
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
Bob Badour
2003-09-07 11:06:44 UTC
Permalink
You don't mention the product you are using. Regardless, I suggest you open
the manual and look for "ALTER TABLE".
Post by rupali007
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
rupali007
2003-09-07 14:38:53 UTC
Permalink
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
Post by Bob Badour
You don't mention the product you are using. Regardless, I suggest you open
the manual and look for "ALTER TABLE".
bforums.com[/url]...
Post by rupali007
hi freinds,
i want to set any composite primary key in given table as
foreigen key
Post by rupali007
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
Post by rupali007
composite primary key in issuedetails.so if i want set
cAccnumber as
Post by rupali007
foreign key then what will be query structure.
this is possible using enterprise manager but i want to do it by
code.so
Post by rupali007
help me if u have any idea.
thanks
--
Posted via
http://dbforums.com/http://dbforums.com



--
Posted via http://dbforums.com
Anith Sen
2003-09-08 16:35:16 UTC
Permalink
i am using sql server 2000.... <<
Try
comp.databases.ms-sqlserver
or
microsoft.public.sqlserver.*
--
- Anith
( Please reply to newsgroups only )
Loading...