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.
| 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=2955Without more insight on what the heading is for, I can only say DO NOT try to do what you posted. |
 |
|
|
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 |
 |
|
|
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') |
 |
|
|
riri
Starting Member
3 Posts |
Posted - 2005-02-02 : 07:33:03
|
| Thanks a lot for your help |
 |
|
|
|
|
|