June 12, 2013 at 4:32 am
use [12]
go
CREATE TABLE Test1
(
TestID uniqueidentifier CONSTRAINT Test_TestID_Default DEFAULT newsequentialid(),
Inserted datetime CONSTRAINT Test_Inserted_Default DEFAULT getdate()
)
ERROR MESSAGE
Msg 2714, Level 16, State 4, Line 1
There is already an object named 'Test_TestID_Default' in the database.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.
I am executing the upper query ,but the below error message shown .
June 12, 2013 at 4:37 am
Change the Name of the Constraint
June 12, 2013 at 5:05 am
The table's two constraints cannot have the same name. Change one of them.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 12, 2013 at 5:23 am
There must be 'Test_TestID_Default' constraint defined for some other table. This should be unique across database.
June 12, 2013 at 7:26 am
I have found that when naming default constraints they are best defined as something line DF_<schema>_<table>_<column>
This avoids name collisons in the same database.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply