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 |
wirawan
Starting Member
1 Post |
Posted - 2009-06-28 : 22:33:47
|
Hi I have StoredProcedure like thisCREATE Procedure savenextmoveerfnrstr@erfdat as datetime,@area as integerAs insert into umzuege (erfnr,ErfDat,area,status) (SELECT ISNULL(MAX(ErfNr) ,0) +1 AS erfnr,@erfdat,@area,'Erfassung' FROM Umzuege where (area=@area) AND (Year(ErfDat)=Year(@ErfDat))) Select @@Identity as 'UmID'returnwhere will create an increment of erfnr with the condition.My question is:for examplewe have erfnr 578, 579, 581, 582where the 580 is missingWhat could be the problem, instead deleting proccess?Could it be because it procced by 2 user in a same time?Please help meThanks |
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-06-29 : 00:08:12
|
u can use identity function identity(578,1)see this link it may helphttp://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server |
|
|
|
|
|