I have a TSQL and want to modify the select statements to create table and insert the selected commands.
set @query = N'SELECT ' + @cols + N' **create table tablename (insert into**
from
(
select substring, Field_Name,
rn = row_number() over(partition by field_name order by fieldnumber)
from bear_crossjoin
) x
pivot
(
max(substring)
for Field_Name in (' + @cols + N')
) p '
How can i define the one in Bold letters?