From: toni.alfirevic@gmail.com   
      
   On Thu, 16 Dec 2010 16:10:12 +0100, Hugo Kornelis wrote:   
      
   > On Thu, 16 Dec 2010 15:55:20 +0100, Toni Alfirevic   
   > wrote:   
   >   
   > (snip)   
   >>Anyone, any clues? Suggestions? Ideas? Anything?   
   >   
   > Without seeing the code, or the error messagesd (if any) returned when   
   > running the code?   
   >   
   > No.   
      
   I'm not actually gonna put in the whole procedure. Just the code that is   
   problematic.   
      
   /***************************************************************   
   ****************   
    Files   
   ****************************************************************   
   ***************/   
   UPDATE [Files] SET   
    [PublicationID]=tr.[PublicationID]   
    ,[Name]=tr.[Name]   
    ,[DateModified]=tr.[DateModified]   
    ,[ModifiedByUserID]=tr.[ModifiedByUserID]   
    ,[Enabled]=tr.[Enabled]   
    ,[ValidFrom]=tr.[ValidFrom]   
    ,[ValidTo]=tr.[ValidTo]   
    ,[FileSize]=tr.[FileSize]   
    ,[Description]=tr.[Description]   
    ,[Keywords]=tr.[Keywords]   
    ,[FileTypeID]=tr.[FileTypeID]   
    ,[Content]=tr.[Content]   
    ,[Width]=tr.[Width]   
    ,[Height]=tr.[Height]   
    ,[WorkflowStatusTypeID]=tr.[WorkflowStatusTypeID]   
    ,[WorkflowStatusChangedByUserID]=tr.[WorkflowStatusChangedByUserID]   
    ,[DateWorkflowStatusChanged]=tr.[DateWorkflowStatusChanged]   
    ,[FileExtension]=tr.[FileExtension]   
   FROM [Files] INNER JOIN [sourceDB].[dbo].[Files] tr ON   
   [Files].[FileID]=tr.[FileID]   
   WHERE tr.[DateModified]>=@TransferFromDate   
   AND EXISTS (SELECT 1 FROM [sourceDB].[dbo].[ExportDSFiles] exds WHERE   
   exds.SmartContentExportID=@SmartContentExportID AND   
   exds.[FileID]=tr.[FileID])   
   SET IDENTITY_INSERT Files ON   
   INSERT INTO Files (   
    [FileID]   
    ,[FileGUID]   
    ,[PublicationID]   
    ,[Name]   
    ,[DateCreated]   
    ,[CreatedByUserID]   
    ,[DateModified]   
    ,[ModifiedByUserID]   
    ,[Enabled]   
    ,[ValidFrom]   
    ,[ValidTo]   
    ,[FolderID]   
    ,[FileSize]   
    ,[Description]   
    ,[Keywords]   
    ,[FileTypeID]   
    ,[Content]   
    ,[Width]   
    ,[Height]   
    ,[WorkflowStatusTypeID]   
    ,[WorkflowStatusChangedByUserID]   
    ,[DateWorkflowStatusChanged]   
    ,[FileExtension]   
   ) SELECT   
    tr.[FileID]   
    ,tr.[FileGUID]   
    ,tr.[PublicationID]   
    ,tr.[Name]   
    ,tr.[DateCreated]   
    ,tr.[CreatedByUserID]   
    ,tr.[DateModified]   
    ,tr.[ModifiedByUserID]   
    ,tr.[Enabled]   
    ,tr.[ValidFrom]   
    ,tr.[ValidTo]   
    ,tr.[FolderID]   
    ,tr.[FileSize]   
    ,tr.[Description]   
    ,tr.[Keywords]   
    ,tr.[FileTypeID]   
    ,tr.[Content]   
    ,tr.[Width]   
    ,tr.[Height]   
    ,tr.[WorkflowStatusTypeID]   
    ,tr.[WorkflowStatusChangedByUserID]   
    ,tr.[DateWorkflowStatusChanged]   
    ,tr.[FileExtension]   
   FROM [sourceDB].[dbo].[Files] tr   
   WHERE NOT EXISTS (SELECT 1 FROM [Files] WHERE [Files].[FileID]=tr.[FileID])   
   AND EXISTS (SELECT 1 FROM [sourceDB].[dbo].[ExportDSFiles] exds WHERE   
   exds.SmartContentExportID=@SmartContentExportID AND   
   exds.[FileID]=tr.[FileID])   
   SET IDENTITY_INSERT Files OFF   
      
   So, nothing very inteligent goin on in there.   
      
   Also... I forgot to mention... That same code used to work just fine,   
   within the transaction.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|