-- #1 Skrypt porównujacy zapisy w tabelach app.files i common.fileRepository 


declare @file_remote_uuid uniqueidentifier
set @file_remote_uuid = 'ace5715d-6737-ee11-95a1-d89d6719e0cb' --wpisz uuid pliku który chcesz sprawdzić

select * from app.files where   file_remote_uuid = @file_remote_uuid 
select * from common.fileRepository where remoteID = @file_remote_uuid 


-- #2 Skrypt porównujacy zapisy w tabelach app.files i common.fileRepository dla metalbdu smarttech



declare @file_remote_uuid2 uniqueidentifier
set @file_remote_uuid2 = '030ab0a3-c4b8-447a-ad59-d55cd1a4d30d' --wpisz uuid pliku który chcesz sprawdzić

select 'NOMA-files',* from CRM_METALBUD_2016.app.files where   file_remote_uuid = @file_remote_uuid2 and file_status>-1
UNION ALL
select 'CLEANETIC-files',* from CRM0100_SMARTTECH.app.files where   file_remote_uuid = @file_remote_uuid2   and file_status>-1

select 'NOMA-fileRepository',[fileRepositoryID], [remoteSource], [remoteID], [parentRemoteSource], [parentRemoteID], [packID], [packType], [packDescription], [fileDate], [fileName], [fileExtension], [fileSize], [contentType], [groupID], [status], [addDate], [addUsername], [modDate], [modUsername], [fullTextKeyword], [fullTextCat], [filePath], [fullTextID], [mailAttachment], [fullTextExtracted], [packTypeID] from CRM_METALBUD_2016.common.fileRepository where remoteID = @file_remote_uuid2  and status>-1
UNION ALL
select 'CLEANETIC-fileRepository' ,[fileRepositoryID], [remoteSource], [remoteID], [parentRemoteSource], [parentRemoteID], [packID], [packType], [packDescription], [fileDate], [fileName], [fileExtension], [fileSize], [contentType], [groupID], [status], [addDate], [addUsername], [modDate], [modUsername], [fullTextKeyword], [fullTextCat], [filePath], [fullTextID], [mailAttachment], [fullTextExtracted], [packTypeID]  from CRM0100_SMARTTECH.common.fileRepository where remoteID = @file_remote_uuid2 and status>-1


