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 |
|
thiyagu2001
Starting Member
1 Post |
Posted - 2011-07-22 : 03:14:18
|
| Hi All,I would like to have the header name with year variable to added with the SUM(). please check the below example:<code>`DECLARE @lJanACTName VARCHAR(30), @lyear Int set @lyear = 2011SET @lJanACTName = 'Jan Act ' + CAST(@lYear AS VARCHAR(10)) SELECT @lJanACTNameSELECT sum(AuditID) as @lJanACTName from ARMS_AuditLogGROUP BY AuditID `</code>My O/P should be **"Jan Act 2011" as a column name**.....Please advice.- Thiyagu |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
|
|
|