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 |
itnagaraj
Yak Posting Veteran
70 Posts |
Posted - 2010-10-13 : 08:57:32
|
Hi, This is query.Select TotalIncidents As'[Total incidets(From' + Mon + ')]' From TanMonthAdvance Thanksit will throw an errorV.NAGARAJAN |
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2010-10-13 : 09:02:57
|
Yes it will.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
itnagaraj
Yak Posting Veteran
70 Posts |
Posted - 2010-10-13 : 09:09:48
|
what is the error in SQLquote: Originally posted by Transact Charlie Yes it will.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
V.NAGARAJAN |
 |
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-10-13 : 09:26:43
|
From your description, my understanding of this issue is: You want todynamically change the header name. If I misunderstood your concern, please feel free to point it out.As'[Total incidets(From' + Mon + ')]' You are trying to dynamically assign column heading. AFAIK, it is not allowed in sql directly like this.There are some couple ways to get dynamic header using Case Statement and other. To suggest you a solution we need to understand your detailed requirement. You need to post table structure, sample data and expected output.Regards,BohraI am here to learn from Masters and help new bees in learning. |
 |
|
itnagaraj
Yak Posting Veteran
70 Posts |
Posted - 2010-10-13 : 09:29:46
|
quote: Originally posted by pk_bohra From your description, my understanding of this issue is: You want todynamically change the header name. If I misunderstood your concern, please feel free to point it out.As'[Total incidets(From' + Mon + ')]' You are trying to dynamically assign column heading. AFAIK, it is not allowed in sql directly like this.There are some couple ways to get dynamic header using Case Statement and other. To suggest you a solution we need to understand your detailed requirement. You need to post table structure, sample data and expected output.Regards,BohraI am here to learn from Masters and help new bees in learning.
V.NAGARAJAN |
 |
|
itnagaraj
Yak Posting Veteran
70 Posts |
Posted - 2010-10-13 : 09:29:47
|
quote: Originally posted by pk_bohra From your description, my understanding of this issue is: You want todynamically change the header name. If I misunderstood your concern, please feel free to point it out.As'[Total incidets(From' + Mon + ')]' You are trying to dynamically assign column heading. AFAIK, it is not allowed in sql directly like this.There are some couple ways to get dynamic header using Case Statement and other. To suggest you a solution we need to understand your detailed requirement. You need to post table structure, sample data and expected output.Regards,BohraI am here to learn from Masters and help new bees in learning.
V.NAGARAJAN |
 |
|
itnagaraj
Yak Posting Veteran
70 Posts |
Posted - 2010-10-13 : 09:32:50
|
This is the resultMonth Total IncidentsSep 200i want month in Header.Header Like [Total incidets(From Sep)].This is the need. quote: Originally posted by pk_bohra From your description, my understanding of this issue is: You want todynamically change the header name. If I misunderstood your concern, please feel free to point it out.As'[Total incidets(From' + Mon + ')]' You are trying to dynamically assign column heading. AFAIK, it is not allowed in sql directly like this.There are some couple ways to get dynamic header using Case Statement and other. To suggest you a solution we need to understand your detailed requirement. You need to post table structure, sample data and expected output.Regards,BohraI am here to learn from Masters and help new bees in learning.
V.NAGARAJAN |
 |
|
|
|
|
|
|