I am trying to generate a stored procedure, or set of stored procedures, to generate a userid. I am taking an existing employee number in the database, performing a looped alogrythm that generates a new employee #, and updating the record with that number.
The stored procedure works when I set the variable @number to a constant. (select @number = 55555) It does not work, however, when I try to pull @number from a column in the database. (select @number = [column]) I want this stored procedure to update the id field for all records in the database.
How do I have the stored procedure pull this existing value in and go through all records in the database to perform the calculation and update the record.
I don't know what syntax to use to assign a column value to the variable. Any help would be really really appreciated!
Thanks.
cgj
create procedure [empid]
The stored procedure works when I set the variable @number to a constant. (select @number = 55555) It does not work, however, when I try to pull @number from a column in the database. (select @number = [column]) I want this stored procedure to update the id field for all records in the database.
How do I have the stored procedure pull this existing value in and go through all records in the database to perform the calculation and update the record.
I don't know what syntax to use to assign a column value to the variable. Any help would be really really appreciated!
Thanks.
cgj
create procedure [empid]