Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 VBScript in SQL Server Agent

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-09-04 : 11:45:09
Paulo writes "I have SQL Server 2000 up and running production databases. It seems to be quite stable.Now I am trying ro write some automated procedures (jobs) through the SQL Server Agent by using VBScript.
Something is not going well, since a job containing only one statement such as

WScript.echo "Hello world"

fails issuing the following error message

Error Code: 0 Error Source= Microsoft VBScript runtime error Error Description: Object required: 'WScript' Error on Line 0. The step failed.

Every book and SQL Server Documentation mention that this should work as simple as it is...

Any hint ?"

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-09-04 : 15:56:37
SQLAgent runs as a service and doesn't have a desktop so where would you expect the output to appear ? If you put in MsgBox "Hello" then the job would hang forever until you stopped it because you would never see the Message box and never be able to press ok. If you want to write to the job history you can SQLActiveScriptHost.Print e.g.

SQLActiveScriptHost.Print "Hello"

If using VBScript then you can just use Print "Hello"
You can also use SQLActiveScriptHost to create objects but again in VBScript you can just use something like Set fso = CreateObject("Scripting.FileSystemObject")


HTH
Jasper Smith
Go to Top of Page
   

- Advertisement -