| Author |
Topic |
|
hdv212
Posting Yak Master
140 Posts |
Posted - 2010-04-08 : 05:32:55
|
| Hiin my query, i need set deynamic caption for my column, something like this :select actionName as actionName+'-'+actionID from actionsbut apparently the 'as' keyword does not support this feature.can anybody have an idea to accomplish this ?thanks in advance |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-04-08 : 05:49:46
|
How should this work if a select returns many different actionID's and you can have only one caption? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-04-08 : 05:50:01
|
| If there are more than one row then what will be caption for your column name ?Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-04-08 : 05:53:18
|
quote: Originally posted by hdv212 Hiin my query, i need set deynamic caption for my column, something like this :select actionName as actionName+'-'+actionID from actionsbut apparently the 'as' keyword does not support this feature.can anybody have an idea to accomplish this ?thanks in advance
Why do you want to do this?MadhivananFailing to plan is Planning to fail |
 |
|
|
tishri
Yak Posting Veteran
95 Posts |
Posted - 2010-04-08 : 07:54:19
|
| DECLARE @sqlCommand varchar(1000)SET @sqlCommand = 'select actionName as actionName' + '-' + actionID + ' from actions'EXEC (@sqlCommand)TCC |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-04-08 : 08:42:55
|
quote: Originally posted by tishri DECLARE @sqlCommand varchar(1000)SET @sqlCommand = 'select actionName as actionName' + '-' + actionID + ' from actions'EXEC (@sqlCommand)TCC
Have you tried executing this?MadhivananFailing to plan is Planning to fail |
 |
|
|
hdv212
Posting Yak Master
140 Posts |
Posted - 2010-04-08 : 11:06:01
|
| Thanks everybodymy query in my fisrt post is just an example and is not my real query!this query does not works :DECLARE @sqlCommand varchar(1000)SET @sqlCommand = 'select actionName as actionName' + '-' + actionID + ' from actions'EXEC (@sqlCommand)i got this error :Msg 207, Level 16, State 1, Line 2Invalid column name 'actionID'. |
 |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-04-09 : 03:34:53
|
quote: Originally posted by hdv212 Thanks everybodymy query in my fisrt post is just an example and is not my real query!this query does not works :DECLARE @sqlCommand varchar(1000)SET @sqlCommand = 'select actionName as actionName' + '-' + actionID + ' from actions'EXEC (@sqlCommand)i got this error :Msg 207, Level 16, State 1, Line 2Invalid column name 'actionID'.
Can you please tell us why you want to do this....???As dynamic caption sounds logical but multiple cation for single column logically its not possible to even think what you want to do i am not gettingVaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
 |
|
|
hdv212
Posting Yak Master
140 Posts |
Posted - 2010-04-09 : 07:30:33
|
| Sure.i want to use dynamic caption in pivot table (cross-tab queries) which you can find here :http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=142412 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|