October 14, 2010 at 11:42 am
I have three staging tables A,B, and C . All these tables have a File_Id in them and a Has_Errors column. I need to validate these tables with my validation stored procs initially in my SSIS package without inserting data into the main tables. If the Has_errors field for all the tables is false then start inserting into the tables else stop the package from running .
Any help will be appreciated.
October 14, 2010 at 12:38 pm
I am trying to do something like this :
ALTER PROCEDURE usp_PreInsert
@File_ID INT
AS
BEGIN
IF (SELECT COUNT(Has_Errors) AS Errors_Entity FROM dbo.Staging_Entities
WHERE File_ID = @File_ID AND Has_Errors > 0
UNION
SELECT COUNT(Has_Errors) AS Errors_Contracts FROM dbo.Staging_Contracts
WHERE File_ID = @File_ID AND Has_Errors > 0
UNION
SELECT COUNT(Has_Errors) AS Errors_Providers FROM dbo.Staging_Providers
WHERE File_ID = @File_ID AND Has_Errors > 0)
PRINT 'START PACKAGE'
ELSE PRINT 'STOp PACKAGE' ;
END
I am getting the following error :
An expression of non-boolean type specified in a context where a condition is expected, near 'PRINT'.
October 14, 2010 at 1:22 pm
Got it
ALTER PROCEDURE usp_PreInsert
@File_ID INT
AS
BEGIN
IF (SELECT COUNT(Has_Errors) AS Errors_Entity FROM dbo.Staging_Entities
WHERE File_ID = @File_ID AND Has_Errors > 0
UNION
SELECT COUNT(Has_Errors) AS Errors_Contracts FROM dbo.Staging_Contracts
WHERE File_ID = @File_ID AND Has_Errors > 0
UNION
SELECT COUNT(Has_Errors) AS Errors_Providers FROM dbo.Staging_Providers
WHERE File_ID = @File_ID AND Has_Errors > 0) = 0
PRINT 'START PACKAGE'
ELSE PRINT 'STOp PACKAGE' ;
END
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply