Does someone know how can I return the @@Identity
when using T-Sql?
Something like this:
set @Sql = "insert into table....values()..."
exec @sql
return @@Identity
It looks like one of your implicit requirements is the execution of dynamic SQL. While I'd advise against this, you can accomplish what you're looking for with this:
set @Sql = 'insert into table....values()...; select SCOPE_IDENTITY()'
exec(@Sql)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With