I have a table with user defined fields i want to keep updated based on the another table. In order to do i created the following query
select
a + b + c + d + e + f + g + h
from
(select
'update gl00100 set USERDEF1 =' as a,
'''' + DMA + '''' as b,
', set USERDEF2 =' as c,
'''' + Brand + '''' as d,
', set USRDEFS1 =' as e,
'''' + convert(char(10), dateopened, 120) + '''' as f,
'where actnumbr_2 =' as g,
GPStore as h
from
[192.168.xxx.xx].bi.dbo.store
where
store <> 0000 and DateOpened is not null) x
As you can tell the query is building the update statements I want to run. How can I run the query and then run the results. Is that even possible?
