Increment a number in a SQL Query based on a value

  • I have an issue where I have a Bill of Material list of items where some of the item numbers are blank. I need to give them sequential numbers from a beginning number like 9000000. then the next blank would be 9000001 and so on. I thought I could create a table and store the number and increment it using a function because I need the function to return other item numbers based on the item number. But when the item number is blank, I am screwed because a function can't update a table. and a stored procedure can't return a value. Any ideas would be appreciated.

    Thanks

  • BTW, it is starting from a view not a SP

  • without some tables it's impossible to diagnose or help.

    Sounds like a job for ROW_NUMBER() but it's hard to say for sure.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply