Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

SQL Server data read using vbs

$
0
0
Hello all. I'm quite inexperienced with vbs and I'm trying to write a VBScript function that will take the following arguments and return success if all returned fields from the query are less than 'Max Age' hours old.

Accept arguments:
SQL Server or Server\Instance
SQL Account Username
SQL Account Password
SQL Query
Max age (in minutes)

Return 0 for failed
Return 1 for succeeded

Example Query:
SELECT [last_execution_date]
FROM [DB].[dbo].[task_tbl]

examples of existing data (SQL data type is datetime):
2013-01-13 22:00:11.323
2013-01-13 23:00:11.933

so basically a compare between the provided Max Age and the dates retrieved by the select. In other words: Tell me everything is fine if last date in DB is 10 mins ago...if the last date is older than that, I want to be alerted. Could anyone give me a hint on how I go about achieving this?

Thank you

Viewing all articles
Browse latest Browse all 13329

Trending Articles