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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 sql server 2008 Agent job (TSQL)
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

8 Posts

Posted - 12/03/2012 :  15:44:52  Show Profile  Reply with Quote
Trying to create a job that steps include finding a file; copying that file; then moving the file. Upon completion an email is sent stating that the job was successful, the email subject should contain the source filename...I keep getting error: "Incorrect syntax near 'objfso'. [SQLSTATE 42000] (Error 102) "

Here's what I have so far:

Dim folder, files, newsfileSET objfso = createobject("Scripting.FileSystemObject")SET f = objfso.getfolder("\\server31\C$\test")SET fc = f.filesSET newfile =

fso.createtextfile("\file_.txt", true)

FOR each f1 IN fcIF LEFT(, 16) = "file_" then
objfso.copyfile f1, "\\server31\C$\move"
objfso.movefile f1, "\\server31\C$\move2"
SET files = f.files
FOR each "file_" IN files
nextSET objmessage = createobject("CDO.Message")
objmessage.FROM = ""
objmessage.TO = ""
objmessage.subject = ("the file called".newfile)
objmessage.textbody = "Job successful."

SET objfso = nothingSET objmessage = nothing
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000