Wednesday 31 August 2011

SQL Server quick compare of central objects to Database for 1 table

SELECT name
FROM jde_development.sys.columns
WHERE object_id = OBJECT_ID('jde_development.testdta.F95625')
and not exists (select 1 from JDE_DV900.dv900.f98711
where TDOBNM = 'F95625' and ltrim(rtrim(TDSQLC)) = name);

select TDSQLC from JDE_DV900.dv900.f98711
where TDOBNM = 'F95625'
and not exists
(SELECT 1
FROM jde_development.sys.columns
WHERE object_id = OBJECT_ID('jde_development.testdta.F95625')
and ltrim(rtrim(TDSQLC)) = name)

No comments: