IS PROBLEM WITH SEVER LEVEL SETIING

  • 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

  • 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/

  • Error Message while execute statment

    MSG 173 level 15

  • 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

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • 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)

  • 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/

  • 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

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • 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)

  • 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.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • 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

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Ah. Thanks for the clarification.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply