Single Row result set is specified, but no rows were returned in Execute SQL Task in SSIS Package - SQL Server Integration Services (SSIS) Tutorial

In this scenario we want to handle a situation in which we might not get the results from our query that we have used in Execute SQL Task in SSIS Package. It is very common error that we get as we have use Result Set to Single Row  and if our query does not return the results, we get an error in SSIS Package. Instead of error. We just want to stop the process with success.


Script used in the video to handle the situation when Execute SQL Task ResultSet is Set to Single Row and Query does not Return Row.
 
 Create Table dbo.FilesToLoad
  ( FolderPath VARCHAR(100),
  FileName VARCHAR(100)
  )
 
  insert into dbo.FilesToLoad
  values ('C:\Users\Aamir\Desktop\InputFolder','Customer_AS_20150425.txt')


Select FolderPath,FileName from dbo.FilesToLoad

Truncate table dbo.FilesToLoad

If exists(
Select FolderPath,FileName from dbo.FilesToLoad)
BEGIN
Select FolderPath,FileName from dbo.FilesToLoad
END
ELSE
BEGIN
SELECT 'Not Exists' as FolderPath,'Not Exists' AS  FileName
END




Single Row result set is specified, but no rows were returned in Execute SQL Task - SSIS Package



 Related Posts / Videos on Execute SQL Task 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.