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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to insert the next sequence of numbers?

Author  Topic 

pras2007
Posting Yak Master

216 Posts

Posted - 2009-10-18 : 22:29:38
Hello All,

I'm trying to insert into an int datatype field which is required. The problem is that field is not an identity field and I need to
insert the next sequence into that field, how would I accomplish that task?

I already tried the row_number() funcation but it only insert 1 as the first record which is wrong

Please advice.

THanks.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-10-19 : 00:01:02
you need to get the current max number first

select max(int_col)
from yourtable



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -