> Is there a way to get the ID of the next record that will be
> inserted into the database?  And I don't mean max(tableID)+1,
> because some records could get deleted and the next row is
> not necessarily going ot be max(tableID) + 1.

Microsoft SQL Server doesn't use sequences like Oracle does, so I don't
think there's a way to get this value other than using MAX(identity_column)
+ 1. However, I would recommend that you not bother with getting this value
in advance anyway. You can just get it after the new record has been
generated, using the SCOPE_IDENTITY function or the @@IDENTITY global
variable.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
phone: 202-797-5496
fax: 202-797-5444
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to