Hi Guys,
Could you please help me with this one:
In one of my scripts I am inserting some data in to some table "Item". One of the columns in the "Item" table is "ItemNumber".
I want to be able to call some function (most probably a Stored proc) where it would return me a numeric number which I can use for the ItemNumber.
I CAN NOT use AutoIncrement because ItemNumber is unique and there might be a collision when in a differnt script I am inserting data in "Item", which already has "ItemNumber"
I only know the Max number for the "ItemNumber" and I am free to use anything after that.
I need a table for this storedProc to store the next number to be used, right?
I was thinking of creating a one column table with the MaxNumber in it and a storedproc where it would return me the MaxNumber and also increment the MaxNumber by 1 for the next use
I need help writing the stored proc and it usage with in the INSERT INTO Item
call.
EDIT:
Basically I am grabbing data from 5 old tables where ItemNumber is either NULL or set. For the ones which are set they are all unique numbers. For the data where the ItemNumber is NULL I want to assign it, what the best approach?
Help please!
Thanks,
Voodoo