Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Why Do i get error running this !!!

Author  Topic 

dbserver2000
Starting Member

47 Posts

Posted - 2009-05-14 : 20:39:28
USE Chapter5;
CREATE TABLE dbo.ArchiveAuditAccess
(
ArchiveAuditAccessID int NOT NULL,
UserName varchar(50) NOT NULL,
LoginTime datetime NULL,
InactiveStatus bit NULL,
CONSTRAINT [DF_Inactive] DEFAULT 1
);

Msg 142, Level 15, State 2, Line 0
Incorrect syntax for definition of the 'TABLE' constraint.


robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-05-14 : 22:40:04
If the default constraint is for the InactiveStatus column, remove the comma between NULL and CONSTRAINT. If it's for a different column, keep the comma, but add "FOR columnName" after. Also, you must include the default value in parentheses. Check Books Online for an example of the syntax.
Go to Top of Page
   

- Advertisement -