Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
crugerenator
Posting Yak Master
126 Posts |
Posted - 2007-06-11 : 09:44:30
|
| If I have my table setup like so...CREATE TABLE Customer(SID integer IDENTITY(1,1) PRIMARY KEY,Last_Name varchar(30),First_Name varchar(30));How would I do an insert statement so that it auto increments and creates a unique number?I keep getting errors. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-11 : 09:49:32
|
By not providing value for Identity column.Insert into Customer(Last_Name, First_Name)values('xx', 'yy')Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-11 : 09:56:21
|
| <<I keep getting errors.>>What is the error?As specified, you should omit it when adding dataMadhivananFailing to plan is Planning to fail |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
crugerenator
Posting Yak Master
126 Posts |
Posted - 2007-06-11 : 16:14:21
|
| worked great. Thanks |
 |
|
|
|
|
|