Results 1 to 5 of 5

Thread: sp_rename

  1. #1
    Join Date
    Sep 2003
    Posts
    5

    Unanswered: sp_rename

    Hi

    Does any one know how i could use this to change a column name from 'L0O24S1_TEXT' to L0O24S1_TEXT. I have tryed this in SQL Server 2000 Query Analyser:
    EXEC sp_rename 'schem_ID_3.'L0O24S3_TEXT'', 'L0O24S3_TEXT', 'COLUMN'

    but got the following error:
    Server: Msg 170, Level 15, State 1, Line 2
    Line 2: Incorrect syntax near 'L0O24S3_TEXT'.

    thanks for any help

  2. #2
    Join Date
    Oct 2003
    Location
    Pune
    Posts
    59

    Re: sp_rename

    Can u specify ur question. What column do u want to change.
    Sorry I was not able to understand ur question

  3. #3
    Join Date
    Sep 2003
    Posts
    5
    sorry about that

    The table is called:
    schem_ID_3

    The column i want to change is currently called:
    'L0O24S3_TEXT'

    and i want to change it to:
    L0O24S3_TEXT

  4. #4
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    140

    Re: sp_rename

    Originally posted by iamwisey
    Hi

    Does any one know how i could use this to change a column name from 'L0O24S1_TEXT' to L0O24S1_TEXT. I have tryed this in SQL Server 2000 Query Analyser:
    EXEC sp_rename 'schem_ID_3.'L0O24S3_TEXT'', 'L0O24S3_TEXT', 'COLUMN'

    but got the following error:
    Server: Msg 170, Level 15, State 1, Line 2
    Line 2: Incorrect syntax near 'L0O24S3_TEXT'.

    thanks for any help
    Try
    EXEC sp_rename 'schem_ID_3.''L0O24S3_TEXT''', 'L0O24S3_TEXT', 'COLUMN'

    You need to add a little quotes (') to help MSSQL make the difference between a quote (part of your column name) and a quote (end of string).

    HTH

    CVM.

  5. #5
    Join Date
    Sep 2003
    Posts
    5
    Thanks a lot that worked perfectly.
    cheers

Posting Permissions

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