compare4

— First get the user IDs once (optional, for readability)
DECLARE @uid1 int, @uid2 int
SELECT @uid1 = uid FROM sysusers WHERE name = ‘GLOBAL_COMET_US_1’
SELECT @uid2 = uid FROM sysusers WHERE name = ‘GLOBAL_COMET_US_2’

SELECT ‘ONLY_IN_US_1’ AS locat…


This content originally appeared on DEV Community and was authored by Query Filter

-- First get the user IDs once (optional, for readability)
DECLARE @uid1 int, @uid2 int
SELECT @uid1 = uid FROM sysusers WHERE name = 'GLOBAL_COMET_US_1'
SELECT @uid2 = uid FROM sysusers WHERE name = 'GLOBAL_COMET_US_2'

SELECT 'ONLY_IN_US_1' AS location, t1.tabname
FROM   sysobjects t1
LEFT JOIN sysobjects t2 
       ON t1.tabname = t2.tabname
      AND t2.uid = @uid2
      AND t2.type = 'U'
WHERE  t1.uid = @uid1
  AND  t1.type = 'U'
  AND  t2.id IS NULL

UNION ALL

SELECT 'ONLY_IN_US_2' AS location, t2.tabname
FROM   sysobjects t2
LEFT JOIN sysobjects t1 
       ON t2.tabname = t1.tabname
      AND t1.uid = @uid1
      AND t1.type = 'U'
WHERE  t2.uid = @uid2
  AND  t2.type = 'U'
  AND  t1.id IS NULL

ORDER BY 1, 2


This content originally appeared on DEV Community and was authored by Query Filter


Print Share Comment Cite Upload Translate Updates
APA

Query Filter | Sciencx (2025-12-02T21:46:49+00:00) compare4. Retrieved from https://www.scien.cx/2025/12/02/compare4/

MLA
" » compare4." Query Filter | Sciencx - Tuesday December 2, 2025, https://www.scien.cx/2025/12/02/compare4/
HARVARD
Query Filter | Sciencx Tuesday December 2, 2025 » compare4., viewed ,<https://www.scien.cx/2025/12/02/compare4/>
VANCOUVER
Query Filter | Sciencx - » compare4. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/12/02/compare4/
CHICAGO
" » compare4." Query Filter | Sciencx - Accessed . https://www.scien.cx/2025/12/02/compare4/
IEEE
" » compare4." Query Filter | Sciencx [Online]. Available: https://www.scien.cx/2025/12/02/compare4/. [Accessed: ]
rf:citation
» compare4 | Query Filter | Sciencx | https://www.scien.cx/2025/12/02/compare4/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.