Hi, Unfortunately that didn't work,
I changed to the @ to ? and still got same error?
columns1, columns2, column3...
-- into #temptable
DECLARE ?cols AS NVARCHAR(MAX),
?query AS NVARCHAR(MAX);
select ?cols = STUFF((SELECT ',' + QUOTENAME(column2)
group by column2
order by column2
FOR XML PATH(''), TYPE
set ?query = 'SELECT columns1,' + ?cols + ' from
max(T.columns1) as columns1
,isnull(T. [column2],0)as [column2]
,COALESCE(T. [column3],0)as [column3]
from #temptable T
group by T.column2, T.column3
for column2 in (' + ?cols + ')
) p '
drop table #temptable;
You can set up an ODBC connection. Do a search in Windows for ODBC and I use 64 bit. Here are screenshots:
I would suggest picking "SQL Server Native Client 10.0" from the driver list.
Give it a name and find your server from the server list.
In terms of authentication, use "Windows authentication":
And then choose your default database:
After all this, test your connection to see if you can connect to it successfully.
You can also do a Google search for setting up ODBC connections and I am sure there are videos on YouTube.
Hope this helps.
Your very helpful; I will try this tomorrow as I used pivot without dynamic to meet a deadline; making this works will be very useful.
I am connecting via Sense not qlikview so you screenshots not that useful; I will research when I have more time later this week and respond appropriately with my results.