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
 Import/Export (DTS) and Replication (2000)
 Alter and DTS

Author  Topic 

riri
Starting Member

3 Posts

Posted - 2005-02-01 : 11:23:44
Does anyone have a clue how to pass a global variable in an ­­Alter
Statement.


The following works


ALTER TABLE [Money] ADD [10/1/2005] int


and I want to have the date as global variable.
Thanks in advance.


Riri


robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-02-01 : 20:25:48
This is NOT a good idea, and probably not practical or possible anyway. If you only need the heading for presentation purposes, you can use a cross tab to achieve the same result:

http://www.sqlteam.com/item.asp?ItemID=2955

Without more insight on what the heading is for, I can only say DO NOT try to do what you posted.
Go to Top of Page

riri
Starting Member

3 Posts

Posted - 2005-02-02 : 04:20:26
Hello again,

I just want this 10/01/2005 to be one of my fields in a table therefore a field's name. Is that possible?

RIRI
Go to Top of Page

Stoad
Freaky Yak Linguist

1983 Posts

Posted - 2005-02-02 : 04:41:35
set @s = '[10/1/2005]'

exec('ALTER TABLE [Money] ADD ' + @s + ' int')
Go to Top of Page

riri
Starting Member

3 Posts

Posted - 2005-02-02 : 07:33:03
Thanks a lot for your help
Go to Top of Page
   

- Advertisement -