BUG:Table-Level Default Constraint in CREATE TABLE Gives ErrorID: Q141665
|
If you include a table-level default constraint in a CREATE TABLE
statement, you will receive the following error:
Msg 170; Severity 15; State 1:
Incorrect syntax near 'for'
Use column-level default constraints. For example, rewrite the above
SQL statement as:
create table tbldef (x int not null constraint cdef default 999, y int)
go
Microsoft has confirmed this to be a problem in SQL Server version 6.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
SQL Server "Books Online" and the "Transact-SQL Reference" manual (page 67)
mention that table-level default constraints can be defined inside a CREATE
TABLE statement. This is a documentation error. The following statement
will give a syntax error:
create table tbldef (x int not null, y int, constraint cdef default 999 for x)
go
Additional query words: SQL6 winnt
Keywords : kbusage SSrvDoc_Err
Version : 6.00
Platform : WINDOWS
Issue type :
Last Reviewed: March 23, 1999