If you want to avoid creation of view and running yearly totals for each Paid_to, as specified in your original problem, then use this:
SELECT 'Capital ' TblId, Paid_to, sYear, sJanuary, sFebruary....
INTO #Temp
FROM Capital
UNION ALL
SELECT 'Advisors ' TblId, Paid_to, sYear, sJanuary...
This should work
Select ltrim(right((' '+ltrim(rtrim(isnull(fieldname,' ')))),7)) user from table1
Note: donot forget to give seven spaces between two quotes
MNK
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.