select top 5 * from emp order by newid()

my question is , how this query get executed?

Answer Posted / praveen n h

SQL server will execute the query in following way...

Select All top 5 rows which are created in the table from
the time it is created.

reason: newid is the key given to each row regardless of
the values that goes into the row of the table.

For example.
if you have created a table temp
and inserted 10 rows, Only fives rows which are created
first will be listed.

Is This Answer Correct ?    2 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell about MOM Tool(Microsoft Operator Manager)?

1405


How can I create a report based on a query? : sql server management studio

555


What is a linked server in sql server?

567


What are wait types?

578


What is relationship? What number of sorts of relationship are there?

629






What stored by the model? : sql server database administration

537


Do you know what is raid and what are different types of raid configurations? : SQL Server Architecture

537


Describe different Processing Modes offered by SSRS?

164


In which files does sql server actually store data?

460


What is a bit datatype?

554


What is difference between count (*) and count 1?

509


Is BCNF better than 2NF & 3NF? Why?

616


What are character string data types in ms sql server?

626


What are the different sql server versions?

506


what are the different types of SSRS reports?

110