Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the diff between Static Queries and Dynamic queries
give me some examples

Answers were Sorted based on User's Feedback



What is the diff between Static Queries and Dynamic queries give me some examples..

Answer / praveen

Static queries are the queries we normally use like SELECT *
FROM EMPLOYEE. where as dynamic queries can be built and
executed dynamically. sp_executesql system stored procedure
is used to execute dynamic sql statements.

Eg: sp_executesql N'select * from employee'

dynamic sql queries will take more time to execute when
compared to static queries

Is This Answer Correct ?    18 Yes 5 No

What is the diff between Static Queries and Dynamic queries give me some examples..

Answer / manoj

Static Queries are permanent and cannot be changed during run-time, like: "SELECT * FROM Employees"

Dynamic Queries can be changed during run-time as they are created by using variables and these variables contain parts of SQL Query, like:

DECLARE @SQL VARCHAR(MAX)
DECLARE @WHENSQL VARCHAR(2000)
DECLARE @SEARCHSQL VARCHAR(500)

SELECT @WHENSQL = 'EmployeeID'
SELECT @SEARCHSQL = '100'

SELECT @SQL = 'SELECT * FROM Employees WHERE ' + @WHENSQL + ' = ' + @SEARCHSQL

EXEC (@SQL)
-- or
EXEC sp_executesql @SQL


For more interview Questions on SQL Server: http://sqlwithmanoj.wordpress.com/interview-questions/

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL Server Interview Questions

Explain “@@rowcount” and “@@error” in sql server?

0 Answers  


Which language is supported by sql server?

0 Answers  


What is a transact-sql statement batch in ms sql server?

0 Answers  


John exports information periodically from a microsoft sql server database to an oracle database what is the best way to do this?

0 Answers  


What is a function? Give some example?

3 Answers  


What happens when unicode strings concatenate with non-unicode strings?

0 Answers  


explain what is a schema in sql server 2005? Explain how to create a new schema in a database? : Sql server database administration

0 Answers  


How to delete multiple rows with one delete statement in ms sql server?

0 Answers  


Tell me about normalization in DBMS.

0 Answers   Honeywell, Zomato,


Explain why variables called the most powerful component of ssis?

0 Answers  


hi,i want t0 knom d syntax for a super key with an example

1 Answers  


How does normalization work?

0 Answers  


Categories