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 2005 Forums
 Transact-SQL (2005)
 Concatenate value inside of the Alias Name

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 TanMonth

Advance Thanks

it will throw an error


V.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 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

itnagaraj
Yak Posting Veteran

70 Posts

Posted - 2010-10-13 : 09:09:48
what is the error in SQL

quote:
Originally posted by Transact Charlie

Yes it will.

Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION




V.NAGARAJAN
Go to Top of Page

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 to
dynamically 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,
Bohra




I am here to learn from Masters and help new bees in learning.
Go to Top of Page

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 to
dynamically 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,
Bohra




I am here to learn from Masters and help new bees in learning.



V.NAGARAJAN
Go to Top of Page

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 to
dynamically 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,
Bohra




I am here to learn from Masters and help new bees in learning.



V.NAGARAJAN
Go to Top of Page

itnagaraj
Yak Posting Veteran

70 Posts

Posted - 2010-10-13 : 09:32:50
This is the result

Month Total Incidents
Sep 200

i 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 to
dynamically 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,
Bohra




I am here to learn from Masters and help new bees in learning.



V.NAGARAJAN
Go to Top of Page
   

- Advertisement -