How many ways to Execute Dynamic Stored Procedures in Sql-Server?

 Posted by vishalneeraj-24503 on 12/3/2013 | Category: Sql Server Interview questions | Views: 2211 | Points: 40

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 

Comments or Responses

Login to post response