I am trying to return the value of the item that was just inserted using a stored procedure. I have 2 stored procedures, GET_ID, and NEW_ID. When I call NEW_ID, I want it to create a new ID in the table (based on a formula) and return the value of the new id. I cannot use identity as the value is not autogenerated, it is calculated. EX:
Create Procedure test
declare @NewID varchar(50)
set @NewID = CONVERT(varchar(50), NEWID())
insert into table1 (newid)
-- All I want is the value of @NewID returned after this executes. Any help would be great.