Hi All
How can I Change The column Name in The table whit out drop it
column_b -- to --column_c
ALTER TABLE doc_exa (ADD) column_b VARCHAR(20) NULLUse sp_rename:
EXEC sp_rename 'doc_exa.column_b' 'column_c' 'COLUMN'
But you'll need to modify all references to column_b to use column_c
Hope that helps,
Lubdha|||Hi Taha
Please look up sp_rename in the Books Online.
EXEC sp_rename 'doc_exa.column_b', 'column_c'
HTH
Kalen Delaney, SQL Server MVP
"Taha" <taha105@.hotmail.com> wrote in message
news:%23Iz0WE2jGHA.4504@.TK2MSFTNGP05.phx.gbl...
> Hi All
> How can I Change The column Name in The table whit out drop it
> column_b -- to --column_c
> ALTER TABLE doc_exa (ADD) column_b VARCHAR(20) NULL
>
>|||Thanks For Reply
When The Table Name Like [Table1] Its Work Fine
But When The Name Is [Table_1] Don't Work
Exec sp_rename 'Table1.[MyColumn]', 'NewName', 'COLUMN' Its Work
Exec sp_rename 'Table_1.[MyColumn]', 'NewName', 'COLUMN' Don't Work
Any idea
Thanks
"Taha" <taha105@.hotmail.com> wrote in message
news:%23Iz0WE2jGHA.4504@.TK2MSFTNGP05.phx.gbl...
> Hi All
> How can I Change The column Name in The table whit out drop it
> column_b -- to --column_c
> ALTER TABLE doc_exa (ADD) column_b VARCHAR(20) NULL
>
>|||This is The Message
Either the parameter @.objname is ambiguous or the claimed @.objtype (COLUMN)
is wrong.
"Taha" <taha105@.hotmail.com> wrote in message
news:%23Iz0WE2jGHA.4504@.TK2MSFTNGP05.phx.gbl...
> Hi All
> How can I Change The column Name in The table whit out drop it
> column_b -- to --column_c
> ALTER TABLE doc_exa (ADD) column_b VARCHAR(20) NULL
>
>|||Show us the sp_help output for the table.
HTH
Kalen Delaney, SQL Server MVP
"Taha" <taha105@.hotmail.com> wrote in message
news:OX6sG32jGHA.4512@.TK2MSFTNGP02.phx.gbl...
> This is The Message
> Either the parameter @.objname is ambiguous or the claimed @.objtype
> (COLUMN) is wrong.
>
>
> "Taha" <taha105@.hotmail.com> wrote in message
> news:%23Iz0WE2jGHA.4504@.TK2MSFTNGP05.phx.gbl...
>
No comments:
Post a Comment