Results 1 to 4 of 4

Thread: SQL query help

  1. #1
    Join Date
    Mar 2009
    Posts
    20

    Unanswered: SQL query help

    Hi i made the above query:

    ALTER TABLE dbo.Cities
    ALTER COLUMN Cities_Name {SET DEFAULT diego}

    With this query i wanna put in Column Cities_Name a default value so that user dont have to write it all the time...
    My problem is that i have a problem in syntax because i get the above error


    ------------
    Msg 102, Level 15, State 1, Line 3
    Incorrect syntax near '{'.
    -----------------------------------

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    the error message is telling you that "{" is wrong

    consult da manual to see what you should be using instead

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Dec 2008
    Posts
    135
    try like this
    alter table Cities add constraint df_k default ('diego') for Cities_Name

  4. #4
    Join Date
    Mar 2009
    Posts
    20
    Hi
    Ok i got it..... but why i add constraint and how i will make the query if i already have default value and want to change it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •