What is the difference between Rand() and NewId() Sql Server function?

 Posted by vishalneeraj-24503 on 10/7/2014 | Category: Sql Server Interview questions | Views: 2322 | Points: 40

Rand() function generates random values which is only and only Numeric values whereas NewId() function generates GUID(unique identifier) which is a combination of both alpha-numeric character.
For Ex:-
Select NewId() as Unique_Id;

will produce A1F3BE10-888C-45A2-8CCB-FB4A0DF37334

Select Rand() as Random_value;

will produce 0.16028902278382

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response