I'm using sql server 7.0...
How can I extract the next identity of a table column?
the best solution I've got is:
dbcc checkident(tbl_PHA_Info) 'Refresh the field
select autoval from syscolumns where id = object_id('tbl_PHA_Info') and name = 'id'
The result looks like this:
0x20000000010000000100000082
I don't know how to extract the 0x20 (wich is the 32 I need)from the result to get the last value of the identity.
Can someone help me convert this varbinary value to get in integer format 0x20(32) 0x01(1) 0x01(1) 0x82(doesn't matter!)?
Can someone confirm me that this method will work all the time?
Is there a better way to do this?
Thx in advance,
Chris
How can I extract the next identity of a table column?
the best solution I've got is:
dbcc checkident(tbl_PHA_Info) 'Refresh the field
select autoval from syscolumns where id = object_id('tbl_PHA_Info') and name = 'id'
The result looks like this:
0x20000000010000000100000082
I don't know how to extract the 0x20 (wich is the 32 I need)from the result to get the last value of the identity.
Can someone help me convert this varbinary value to get in integer format 0x20(32) 0x01(1) 0x01(1) 0x82(doesn't matter!)?
Can someone confirm me that this method will work all the time?
Is there a better way to do this?
Thx in advance,
Chris