Answer:
There are the 2 ways to execute dynamic sp in sql-server:-
1). exec(@sql_query).
2). exec sp_executesql @sql_query.
Here,@sql_query is a variable which should be of Nvarchar,Varchar data-type depends on the requirement.
These statement we write inside SP.
Here,sp_executesql is an in-built sql-server function.
Asked In: Many Interviews |
Alert Moderator