Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not sending an Empty File 1

Status
Not open for further replies.
Mar 12, 2003
678
US
I e-mail an error report through a dts package but sometimes the report is empty. How can I tell the dts package not to send the e-mail. I am new to dts so if you could explain it as easily as possible. Thanks.
 
declare @count int
select @int count(*) from table .... (same query as whatever populates the file)
if @count <> 0
begin
send mail
end

“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" --
 
I hope this doesn't sound stupid, but do I put this in an execute sql task in the dts package.
 
you can like this

declare @count int
select @int count(*) from table .... (same query as whatever populates the file)
if @count <> 0
begin
exec master..xp_sendmail ...etc etc etc
end

“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" --
 
When I run this code I get the following Error:

Must declare the variable '@int'.
 
Oops typo should be

declare @count int
select @count =count(*) from table .... (same query as whatever populates the file)
if @count <> 0
begin
exec master..xp_sendmail ...etc etc etc
end

“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top