CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS DATABASE SQL SERVER DETAILS
Question :
What is DYNAMIC SQL method ?
Category SQL Server Interview Questions
Rating (0.0) By 0 users
Added on 4/3/2008
Views 625
Rate it!
Answers:

In dynamic SQL method 4 in queries(select ) there are variable number of column and bind variable . Other word we can say that until run time we don't how many bind varible there.

Exemple :-

select :select_list Column from tablename where :wherecluase



Dynamic SQL are SQL statements that are mainly used to bind variables to column names.
If we want to fetch say 2 columns fron N number of tables, then instead of writing that many Stored procedures, we can write a single stored procedure to get the desired result.
For eg
Create proc test
(colname_comma_separated varchar(max),
tablename varchar(100))
as

declare @sql varchar(max)

set @sql = 'SELECT ' + colname_comma_separated + ' from ' + tablename

exec(@sql)



 Posted by: Pawan Tewari    

Contact Pawan Tewari  Contact Pawan Tewari


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
What is the query used to display all tables names in SQL Server (Query analyzer)?
View Answer
What is the query used to display all tables names in SQL Server (Query analyzer)?
View Answer
What is a dirty page and dirty report?
View Answer
What are the new enhancements in SQL server 2005?
View Answer
Difference between a "where" clause and a "having" clause?
View Answer
Write sql query for retrieving employee names from employee table who are having salary greater than 5000 without using where clause?
View Answer
Explain real time situation where you would use clustered and Non-clustered Indexes?
View Answer
What is the pivot operator in MS SQL Server2005? What is the use of it and how do we use it
View Answer
What are "HINTS"? What is "index covering" of a query?
View Answer
What are data objects?
View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL SQL Server Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/14964/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.94