Wednesday, March 7, 2012

How to Retrieve Next Value from Field?

Hi All,

I have a table with a column called SRGTE_KEY_1 which is also referenced as an index with an Index name of EMDET_i0. The Data Type is Varbinary.

I have a trigger when activated inserts data into this table. However my problem is that I need to determine what is the next available Varbinary value in the SRGTE_KEY_1 column so I can use this value with my Insert otherwise the trigger will Fail if I dont specify a Unique Value.

What SQL statement/s can I write to be able to obtain the next Unique Value from this Column.

A Step by Step procedure would be great as well as syntax. Thanks for your help.

Regards
AnthonyWhat do you mean by the next available value?
If you mean treat it like an integer and add 1 then maybe it shouldn't be a varbinary.
Or do you have a tabe which gives the available values?|||By the next available value I mean any value that is not being used(thats what I mean by next available) so duplication wont occur. I'm not sure how to obtain this as its varbinary. I wouldn't have a problem if it was a numeric value, but I don't know about this data type.

No comments:

Post a Comment