The newsequentialid() built-in function can only be used in a DEFAULT expression for a column of type 'uniqueidentifier' in a CREATE TABLE or ALTER TABLE statement. It cannot be combined with other operators to form a complex scalar expression.

Error Message:
Msg 302, Level 16, State 0, Line 1
The newsequentialid() built-in function can only be used in a DEFAULT expression for a column of type ‘uniqueidentifier’ in a CREATE TABLE or ALTER TABLE statement. It cannot be combined with other operators to form a complex scalar expression.

Severity level:
16.

Description:
This error message appears when you try to call the newsequentialid() function outside the scope of a DEFAULT expression for a column.

Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.

Resolution:
Errors of the Severity Level 16 are generated by the user and can be fixed by the SQL Server user. The statement cannot be executed this way. Newsequentialid() can only be used within a DEFAULT expression of a column.

Versions:
This error message was introduced with SQL Server 2005.

Example(s):
SELECT NEWSEQUENTIALID()

Remarks:
In the above example we try to use the NEWSEQUENTIALID() function in a SELECT statement. This raises the error.

]]>

Leave a comment

Your email address will not be published.