Click here to Skip to main content
15,885,869 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
what is dynamic query.. and any one give definition and example..
Posted

Definition:
Quote:
A dynamic SQL in a stored procedure is a single Transact-SQL statement or a set of statements stored in a variable and executed using a SQL command.
--Building Dynamic SQL In a Stored Procedure[^]

Go through following very good articles already available over the internet.
Building Dynamic SQL In a Stored Procedure[^]
SQL SERVER – Executing Dynamic SQL[^]
Execute Dynamic SQL commands in SQL Server[^]

Hope, it helps :)
 
Share this answer
 
Generally, a dynamic SQL statement is a SQL query stored as a string in a variable and then executed by Exec command.

Check the link below. It has a lot of examples:

Building Dynamic SQL In a Stored Procedure[^]
 
Share this answer
 
Google is your friend, be nice and visit him often: he can answer queries a lot faster than we can.
A simple Google took me right to MSDN: https://technet.microsoft.com/en-us/library/aa237255(v=sql.80).aspx[^]

In future, please try to do at least basic research yourself, and not waste your time or ours.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900