I have simple requirement, wanting to replace the Null Values with '-' in my code, please find the attachment. I know this could be achieved by ISNULL function, not sure where exactly to implement in the code.
Also want to create a new table from this result set. Something like Select * into [tablename] from [oldtablename]
Hope am clear.
Any suggestions are highly appreciated. resultSet.xls
declare @cols nvarchar(2000)
select @cols = stuff(( select distinct top 100 percent '],[' + convert(varchar,t2.Calldate,105)
from [Source table] as t2
order by '],[' + convert(varchar,t2.Calldate,105)
for xml path('')), 1, 2, '') + ']'
declare @query nvarchar(4000)
set @query = 'select [Mobile no],' + @cols +
'from (select [Mobile no],convert(varchar,CallDate,105) CallDate,Disposition from [Source table]) t1
pivot (max(Disposition) for Calldate in (' + @cols + ')) as p'