REM echo %2 >> log\all.log
sqlcmd -S
type log\upgrade%2.log >> log\all.log
:END
upgrade.sql:
DECLARE @vsql NVARCHAR(4000)
SET @vsql = ''
Declare @serverName NVARCHAR(255)
Declare @sitecode NVARCHAR(50)
set @serverName = '$(servername)'
set @sitecode = '$(sitecode)'
Print @serverName
Print @sitecode
SET @vsql = 'SET IDENTITY_INSERT dbo.[
insert into dbo.[GL_Site_SourceTests]
(
select distinct
from ['+@serverName +'].'+ @sitecode +'_dmss.dbo.[
where not exists (select 1 from dbo.[
where i.site_tk = s.site_tk
and i.gl_site_sourceTest_tk = s.gl_site_sourceTest_tk)
SET IDENTITY_INSERT dbo.[
--Print @vsql
EXEC sp_executesql @vsql