Shoutbox

MS SQL questions - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: MS SQL questions (/showthread.php?tid=57326)

MS SQL questions by Wabz on 03-22-2006 at 11:31 AM

Hey guys I'm making a database in Enterprise manager :S

I'm trying to create some tables  but need to create a compound key any ideas how to do this because I'm not too sure

code:


Create table tblhelp (
date datetime not null,
helpid varchar(3) not null,
helplocation varchar(10) not null,
random int,
spacefiller varchar(18),
)




date, helpid, and helplocation all need to be a compound key for the tables to work properly.  (Although this isn't really my table because I'd just confuse myself if I used the real thing at the moment.)

Any ideas guys
RE: MS SQL questions by Adeptus on 03-23-2006 at 12:14 AM

code:
CREATE TABLE tblhelp (
date datetime NOT NULL,
helpid varchar(3) NOT NULL,
helplocation varchar(10) NOT NULL,
random int,
spacefiller varchar(18),  /* what the heck is this? */
CONSTRAINT pk_tblhelp PRIMARY KEY (date, helpid, helplocation)
)


Documentation available at http://msdn.microsoft.com/library/en-us/tsqlref/ts_create2_8g9x.asp