Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing variable to identity function

Status
Not open for further replies.

delfy

MIS
Feb 8, 2005
96
0
0
JM
here is an example of what i am trying to do
declare @max_key

select @max_key = max(key) from parts

declare @parts_history table(
parts_history_key int identity(1,@parts_history)
)

why can't i use a variable in the identity function above
 
This is T-SQL limitation.

No big deal... create it as identity(1, 1) and then use parts_history_key + @max_key whenever you need "correct" value in SELECT statements.

------
[small]select stuff(stuff(replicate('<P> <B> ', 14), 109, 0, '<.'), 112, 0, '/')[/small]
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top