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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 change column name base on e val of another table

Author  Topic 

sg2255551
Constraint Violating Yak Guru

274 Posts

Posted - 2006-08-11 : 00:08:29
how do i change the column name of a table based on the value of another table? I have 2 tables namely tblData and tblDate

For example:

tblData:

Col1 Col2 Col3
---- ---- ----


tblDate:

coldate
----------
08/12/2006
08/19/2006
08/26/2006

How do i change col1 col2 col3 to 08/12/2006 08/19/2006 08/26/2006. Thanks

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-08-11 : 00:17:29
You can use the SP_RENAME stored procedure to rename a column in a table.


CODO ERGO SUM
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-08-11 : 00:18:05
is this same as this thread http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=70292 ?


KH

Go to Top of Page

sg2255551
Constraint Violating Yak Guru

274 Posts

Posted - 2006-08-11 : 00:40:32
ok, Thanks.

My tblData comes from an export package and it is schedule to execute every week and the values of tblDate would change everey week as well.

Actually, i have a DTS package that does the export of data from other table to tblData and would like to write some sql statement to rename the columns each time the package execute. How should I write the sql statement to be used in my package? thanks
Go to Top of Page

sg2255551
Constraint Violating Yak Guru

274 Posts

Posted - 2006-08-13 : 22:58:17
hi

Thanks for the post. I have managed to solved it. Once again.Thanks
Go to Top of Page
   

- Advertisement -