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 |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-12-09 : 12:40:56
|
Eoin writes "i want to know whether it is possible to create dynamic primary keys in plain sql. what i am trying to do in my tables is get the max of an integer column in a table, add 1 to it, and let this value be the primary key for my table. i thought i might be able to do it like this:INSERT INTO organisation VALUES(MAX(TelephoneNumber)+1,...etcwhere telephone number is an integer column. however, apparently its not possible to place a GROUP BY function here. is there another way to do this or should this be taken care of with embedded SQL?thanks" |
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2001-12-09 : 13:27:43
|
Is this what you were trying to achieve?INSERT INTO organisation SELECT MAX(TelephoneNumber)+1,... FROM organisation What about this GROUP BY? |
|
|
|
|
|