select top 5 * from emp order by newid()

my question is , how this query get executed?

Answer Posted / sanjeev kumar

newid() used with uniqueidentifier data types in a table
and uniqueidentifier datatype is used to insert randomly
new number, so the above query will give top 5 records in
randomly manner.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Data table as parameter in sql server?

556


Write the syntax for stuff function in an sql server?

527


How to truncate the log in sql server 2012? : sql server database administration

565


What is built-in function?

541


What is a subquery in a select query statement in ms sql server?

578






How many types of subqueries are there in sql server?

461


According to you what goes into making the best database administrator? : sql server database administration

539


What do you understand by user-defined function in the sql server and explain the steps to create and execute a user-defined function in the sql server?

512


You have modified 100 store procedures and want to replicate these changes from development to prodution, and production can have users using the Server/DB, how would you replicate without causing issues?

1719


explain what is raid and what are different types of raid configurations? : Sql server database administration

540


What is the sql server 2000 version number?

545


What options are available to audit login activity? : sql server security

631


What is indexing in sql server with example?

515


Is it possible in sql table to have more than one foreign key?

606


Are null values the same as that of zero or a blank space?

567