January 18, 2011 at 2:51 am
This Statment Working fine Without any issue
create table #table
(
id INT identity(1, 1) primary key,
unique(id)
)
But Script not working on another machine,It's throwing execption
ENCLUDE DATA TYPE FOR UNIQUE CONSTRAINT
January 18, 2011 at 3:02 am
I couldn’t find an error like that in SQL Server 2005. Are you sure that you are using SQL Server 2005 and not a different edition (for example sql server mobile)? If you are using SQL Server 2005 could it be that you have a DDL trigger that is using raiserror in it and the trigger is responsible for the error? If this is the case, the error number should be at least 50000. Can you post the error number?
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
January 18, 2011 at 3:16 am
Error Message while execute statment
MSG 173 level 15
January 18, 2011 at 3:22 am
Your code works fine on SQL 2008.
Error 173 says nothing about unique constraints. It's text is:
The definition for column '%.*ls' must include a data type.
Can you post the full and exact error message that you get and the version of SQL that you're running the query on? (SELECT @@Version)
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 18, 2011 at 3:30 am
Error message
The definition for column unique must include a data type.
Version
Microsoft SQL Server 2005 - 9.00.4035.00 (X64) Nov 24 2008 16:17:31 Copyright (c) 1988-2005 Microsoft Corporation Developer Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)
January 18, 2011 at 3:52 am
I don’t know why on one server you have an error and on other server you don’t. Maybe you have different service packs on both servers. In any case it seems that you are trying to have 2 constraints on the same column – first constraint is Primary key and second constraint is Unique constraint. No reason to do that. If the column is primary key, then it is also unique.
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
January 18, 2011 at 4:50 am
Is that the version of the server it does work on or the version of the server it doesn't work on?
Can you post the version of the other one?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 19, 2011 at 3:51 am
Server version
Microsoft SQL Server 2005 - 9.00.4035.00 (Intel X86) Nov 24 2008 13:01:59 Copyright (c) 1988-2005 Microsoft Corporation Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
January 19, 2011 at 11:13 am
Is "id" perhaps a user created data type that doesn't exist on the new server?
EDIT: I ask because I've never seen unique(id) as proper column name before. It looks more like a function and I can't find a unique() command in BOL.
January 19, 2011 at 11:26 am
Brandie Tarvin (1/19/2011)
EDIT: I ask because I've never seen unique(id) as proper column name before. It looks more like a function and I can't find a unique() command in BOL.
There isn't such a function. That's how you specify an unnamed unique constraint
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 19, 2011 at 11:33 am
Ah. Thanks for the clarification.
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply