You cannot retrieve an ID since there is no ID being inserted.....
But you can:
just query the table using the same criteria as in your
UPDATE
:SELECT TableID FROM dbo.Table WHERE SC = @SC AND Service = @Ser -- just use the same criteria
use the
OUTPUT
clause on theUPDATE
to get that info:UPDATE [Table] SET Active = 1, Subscribed = 1, RenewDate = GETDATE(), EndDate = DATEADD(mm,1,getdate()) OUTPUT Inserted.TableId -- output the TableID from the table WHERE SC = @SC AND Service = @Ser
Read more about the OUTPUT
clause on Technet - it can be used on INSERT
and DELETE
as well