If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > sp_rename

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-08-03, 04:50
iamwisey iamwisey is offline
Registered User
 
Join Date: Sep 2003
Posts: 5
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
Reply With Quote
  #2 (permalink)  
Old 10-08-03, 05:07
cyrus cyrus is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 10-08-03, 05:11
iamwisey iamwisey is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 10-08-03, 06:07
cvandemaele cvandemaele is offline
Registered User
 
Join Date: Oct 2003
Location: Switzerland
Posts: 140
Re: sp_rename

Quote:
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.
Reply With Quote
  #5 (permalink)  
Old 10-08-03, 06:14
iamwisey iamwisey is offline
Registered User
 
Join Date: Sep 2003
Posts: 5
Thanks a lot that worked perfectly.
cheers
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On