Interview Questions

What does this return on SQL Server 2005? select NEWSEQUENTIALID()

Microsoft SQL Server FAQs


(Continued from previous question...)

What does this return on SQL Server 2005?
select NEWSEQUENTIALID()

Answer: This returns an error.

Explanation: This returns an error. The NEWSEQUENTIALID() function can only be used in a default constraint on a table, not in a query. When used there it returns a new GUID that is greater in value than any previously generated GUIDs.

(Continued on next question...)

Other Interview Questions