Here Mudassar Ahmed Khan has explained with an example, how to write and execute dynamic SQL Query in SQL Server.
Dynamic SQL Query can be executed using EXEC and sp_executesql commands in SQL Server.
Execution of dynamic SQL is supported in SQL Server versions i.e. 2000, 2005, 2008, 2008R2, 2012, 2014 or higher.
↧