|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
ALTER TABLE problem!!
The below doesn't seem to be supported on SQL 2000 or Access.
ALTER TABLE TableName RENAME OldField TO Newfield Is there a way I can alter a column name without going into the design of the table? I want to supply a client of my company with a SQL statement to alter a table name, rather than allowing them to see the table design in Enterprise Manager. I can get round it by trying the below, but it's a bit long winded. ALTER TABLE TableName ADD NewField Char(20) UPDATE Tablename SET NewField=OldField ALTER TABLE Tablename DROP COLUMN OldField Cheers Steve |
|
#2
|
||||
|
||||
|
Alter a table name or alter a column name?
|
|
#3
|
|||
|
|||
|
I'm lookin to alter a column name.
|
|
#4
|
||||
|
||||
|
You can do it like this
Code:
sp_rename 'table.old_fieldname', 'new_fieldname', 'COLUMN' Example: This will rename the JobID column in an Employers table, to JobNum. Code:
sp_rename 'Employers.JobID', 'JobNum', 'COLUMN' |
|
#5
|
|||
|
|||
|
Excellent. Thanks for that
|
|
#6
|
|||
|
|||
|
ALTER TABLE TableName RENAME OldField TO Newfield
You can change it through Enterprise manage can't you ?
Quote:
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > ALTER TABLE problem!! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|