Reputation: 133
I want to create a package where I want to see if the data exists in the select statement, then send an email along with the data(doesn't matter in which form- excel/text file) else nothing.
Could you please suggest what tasks I need to use in the package? Basically doing T-sql to check if location changed of employees, if so, notify via email and providing the data that changed in the email.
Thanks in advance!
Upvotes: 1
Views: 3249
Reputation: 37313
You have to use an Execute SQL Task, to check if Data Exists and assign a Value to a Result Set.
Example
IF EXISTS(SELECT 1 FROM TABLE)
SELECT 1 AS Result
ELSE
SELECT 0 AS Result
Then you should specify that the Execute SQL store the returned value in a single Row result set For more info refer to this link
Then you should add precedence constraint with the following expression (assuming that @[User:ResultValue]
is the variable where ResultSet is stored)
@[User:ResultValue] == 1
And You can refer to the following question for detailed answer about sending sql query result as mail
Upvotes: 1