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 |
|
mdelgado
Posting Yak Master
141 Posts |
Posted - 2002-04-26 : 15:50:49
|
| Hello all...My question today deals with creating a 'Calculated Column Name'For example, I want to run a simple select statement that returns one column having the column name equal to a dynamic value...SUM(CASE quarter WHEN 1 THEN amount ELSE 0 END) as getdate()-1FROM qtrsales qGROUP BY year I would like the column name to display a date calculation.Any Ideas?thanks.... |
|
|
skond
Yak Posting Veteran
55 Posts |
Posted - 2002-04-26 : 16:26:54
|
| declare @sql varchar(8000)set @sql = 'select getdate() as c_' + convert(varchar(10),getdate(),112) + ' from don_to_sql_names'exec(@sql) |
 |
|
|
mdelgado
Posting Yak Master
141 Posts |
Posted - 2002-04-26 : 16:35:41
|
| THANK YOU!! |
 |
|
|
|
|
|