Posted by: rawbee January 6, 2009
SQL Guff
Login in to Rate this Post:     0       ?        

Hello Here is solution:


a) How to find the 3rd largest value from a column ( not using stor proc) ?
- first you pick top 3 value from column  with desc order
- pick top 1 from above  with asc order


In AdventureDatabase to  get Third ListPrice


SELECT TOP 1 T.ListPrice FROM


(SELECT DISTINCT TOP 3 ListPrice FROM Production.Product


ORDER BY ListPrice DESC


)T


ORDER BY T.ListPrice ASC


b) Difference between index hint and table hint.


Table hints override the default behavior of the query optimizer for the duration of the data manipulation language (DML) statement by specifying a locking method, one or more indexes, a query processing operation such as a table scan or index seek, or other options


c) Dynamic Queries and Static Queries.


- SQ gives always same value while DQ gives different value on Execution. You can take a simple example. when you make a condition like name = "stylish" it gives fixed result but when you pass some @name parameter it gives differnt value( this is just simple ex)


d) Whats the difference between using set and select for setting the value inside the stored procedure.


SET can only assign one variable at a time, SELECT can make multiple assignments at once


e) How do you call the nested stored procedure?


i dont have exact example right now but here is a link ,i found for you.


http://www.sqlservercentral.com/articles/Basic+Querying/nestingstoredprocedures/998/


 


hopefully, i will help you..


all the best


 


 


 


 


 

Read Full Discussion Thread for this article