Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

multi-field primary key
I have a table (table1) that has a bunch of fields....

[field1]
[field2]
[field3]
[field4]
[field5]

None of these fields are unique, but if I combine them, then they are
unique.

I know there is a way to make multi-field primary keys, but when I try
I get an that field1 is not unique, which I already know,

How can I make a multi-field primary key?

thanks


Report this thread to moderator Post Follow-up to this message
Old Post
sql guy123
11-28-05 06:23 PM


Re: multi-field primary key
ALTER TABLE table1
ADD CONSTRAINT pk_table1 PRIMARY KEY (col1, col2, col3, col4, col5) ;

Tip: "column" and "row" are the terms usually preferred over "field"
and "record" when discussing SQL databases. Some people will argue that
there are quite different concepts attached to the different names and
that the distinction is a very important one. Others use the names
interchangeably without worrying to much about the formal definitions.
Still, you won't be called wrong if you stick with the terms "column"
and "row". :-)

Hope this helps.

--
David Portas
SQL Server MVP
--


Report this thread to moderator Post Follow-up to this message
Old Post
David Portas
11-28-05 06:23 PM


Re: multi-field primary key
thanks, I try it


Report this thread to moderator Post Follow-up to this message
Old Post
sql guy123
11-29-05 01:25 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 03:02 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006