Hi all,
well i want to have an web-based database application in which in an single webform , i need to insert the values to 5 different tables.
here empid is primary key (PK) in one table and in the rest of the tables its an Foreign Key(FK)
my question is, how can i create these tables with composite key?
ie, i want to creat an table which will have FK and as well another key which both will uniquely idenitfies a row.
Well i am using SQL server 2000 and i wish to create these tables using the enterprise manager.
here are the tables
1) empidtable
empid,fname,lname
2)empcountrytable
empid,country
3)empvisatable
empid,visa
4)empdoctable
empid,doc
5)empfile
empid,filename,filecontenttype,filesize,filedata
Plz do help me
thanx in advance
If you're using Enterprise Manager, go to Design View of the table anduse control + click to select all the columns you want as part of thecomposite key, then right-click Set Primary Key.
|||The table with the composite key will have all the primary key columns of the five tables because a composite index must be on one table. You can have up to 16 columns and 900bytes so if you are using unicode you can only have NVARCHAR (450). The alternative which is used by Microsoft Consulting is to create a small Clustered index and add the column of the clustered index in all your nonclustered index on the table. You can use the index tuning Wizard which is part of the profiler to tell you the indexes you need on a table. Hope this helps.|||
Hey thanks for that.
will try to implement the same
No comments:
Post a Comment