Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Altering column name

Author  Topic 

sital
Yak Posting Veteran

89 Posts

Posted - 2009-05-14 : 01:35:17
Hi all,

I have created the following table :

create table LogSummary
(
LogSummary_Category varchar(30),
LogSum_Count int
)

Now, I want to alter the column name LogSummary_Category and change the name to LogSum_Category.

I am using the following alter statement:

alter table LogSummary modify 'LogSummary_Category' 'LogSum_Category' varchar(30)


But the above statement results in the following error can anybody let me know what is the error?

Error :
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'LogSummary_Category'.


Please help me out to change the column name.

Thanks in advance

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-05-14 : 02:01:34
Read about sp_rename in sql server help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

raky
Aged Yak Warrior

767 Posts

Posted - 2009-05-14 : 02:12:36
EXEC SP_RENAME 'LogSummary.LogSummary_Category','LogSum_Category','Column'
Go to Top of Page
   

- Advertisement -