Use of NewId() function

Posted by vishalneeraj-24503 under Sql Server category on | Points: 40 | Views : 579
The NewId() in-built function generates a unique value of type uniqueidentifier.We have to include the NewId() in-built function in the Order By clause in the Select statement.

We can understand NewId() function with simple example:

select top 20 emp_id,employee_name,email_id,pan_number,address
from employee_master
order by newid();

It will generate 20 random rows.

Comments or Responses

Login to post response