January 4, 2011 at 7:43 am
Hi ,
I am trying to get the report using Query , looks like very easy but i am not ablt to get the correct Output
I need the report like ..
for example I have table with 2 Columns
A & B with values 1 & 2
I need a Result set with 2 columns A&B with values like " ColumnName + Value " as A=1 & B=2 which the output looks like
A | B
A=1 | B=2
Thanks
John
/****/
January 4, 2011 at 8:02 am
Probably a dreadfull way of doing it but off the top of my head.
SELECT
'A=' + CAST(a AS VARCHAR(255)) AS 'A'
,'B=' + CAST(b AS VARCHAR(255)) AS 'B'
FROM tblWhateverYourTableIsCalled
Ben
^ Thats me!
----------------------------------------
01010111011010000110000101110100 01100001 0110001101101111011011010111000001101100011001010111010001100101 01110100011010010110110101100101 011101110110000101110011011101000110010101110010
----------------------------------------
January 4, 2011 at 8:02 am
This might be what you are looking for:
CREATE TABLE #MyTable(A INT, B INT)
INSERT INTO #MyTable
SELECT 1,2 UNION ALL
SELECT 1,1 UNION ALL
SELECT 3,4
SELECT 'A = ' + CAST(A AS VARCHAR(2)), 'B='+ CAST(B AS VARCHAR(2)) FROM #MyTable
DROP TABLE #MyTable
Results:
A = 1B=2
A = 1B=1
A = 3B=4
January 4, 2011 at 9:39 am
Thanks a Lot ..
It's working .. BUNCH of THANKS
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply