I want to insert a record into a table which is having an identity column.
when i am explicitly setting the IDENTITY_INSERT ON, i am able to insert, but when i use the same in a stored procedure, it is not working. The below line is not working in the SP
set @sql='SET IDENTITY_INSERT '+@TableName+' ON'
here table name i am passing as parameter.
Can anybody please help me.