dbTalk Databases Forums  

DOS Batch File Running osql - opening/closing connections

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss DOS Batch File Running osql - opening/closing connections in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Stephen2
 
Posts: n/a

Default DOS Batch File Running osql - opening/closing connections - 07-20-2007 , 07:14 AM






I've written a small dos batch script that runs a simple query through
osql and then calls an exe which sends an email if the returned value
Quote:
0.
The query checks if a value in a column has not been updated for 5
mins and raises a warning through an email and it will need to run
throughout the online day.

Will there be any issues continually opening & closing connections in
this way?

Would there be any advantage in scheduling it as a job in Windows v a
scheduled job in SQL Server to run every 5 mins?

Thanks.



Reply With Quote
  #2  
Old   
Dan Guzman
 
Posts: n/a

Default Re: DOS Batch File Running osql - opening/closing connections - 07-20-2007 , 07:40 AM






I don't see a problem with running a polling process like this every 5
minutes. Personally, I'd do this in SQL Agent job with a single
Transact-SQL step and use database mail if SQL 2005 or xp_smpt_sendmail
(http://www.sqldev.net/xp/xpsmtp.htm) if SQL 2000.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Stephen2" <Stephen (AT) mailinator (DOT) com> wrote

Quote:
I've written a small dos batch script that runs a simple query through
osql and then calls an exe which sends an email if the returned value
0.

The query checks if a value in a column has not been updated for 5
mins and raises a warning through an email and it will need to run
throughout the online day.

Will there be any issues continually opening & closing connections in
this way?

Would there be any advantage in scheduling it as a job in Windows v a
scheduled job in SQL Server to run every 5 mins?

Thanks.



Reply With Quote
  #3  
Old   
Stephen2
 
Posts: n/a

Default Re: DOS Batch File Running osql - opening/closing connections - 07-20-2007 , 08:01 AM



On Jul 20, 1:40 pm, "Dan Guzman" <guzma...@nospam-
online.sbcglobal.net> wrote:
Quote:
I don't see a problem with running a polling process like this every 5
minutes. Personally, I'd do this in SQL Agent job with a single
Transact-SQL step and use database mail if SQL 2005 or xp_smpt_sendmail
(http://www.sqldev.net/xp/xpsmtp.htm) if SQL 2000.

Thanks Dan, that would be a better way but I couldn't get either sql
mail or xp_smpt_sendmail to work. It's a bit like the blind leading
the blind here. I just need a quick & easy solution in the short term.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.