Can someone explain why this fails as a SQL job?



Thanks



'**********************************************************************

' Visual Basic ActiveX Script

'************************************************************************



Function Main()

dim fs,f

set fs=CreateObject("Scripting.FileSystemObject")

set f=fs.GetFile("e:\slxdbs\Recycle.csv")

f.Copy"e:\slxdbs\New_Recycle.csv",true

set f=nothing

set fs=nothing

Main = DTSTaskExecResult_Success

End Function

Re: Simple VB Script by ahmed_sami

ahmed_sami
Tue May 24 14:32:26 CDT 2005

it seems that you are a former C programmer buddy :)

well, vb scripts (unlike Visual Basic and C++,etc) main body is not included
within functions (eg mail())
just remove the first line and the last two lines and it will work.

cheers,
S@mi

"David VanSickle" <david.vansickle@bcbsne.com> wrote in message
news:%23nP7nRJYFHA.3584@TK2MSFTNGP12.phx.gbl...
> Can someone explain why this fails as a SQL job?
>
>
>
> Thanks
>
>
>
> '**********************************************************************
>
> ' Visual Basic ActiveX Script
>
> '************************************************************************
>
>
>
> Function Main()
>
> dim fs,f
>
> set fs=CreateObject("Scripting.FileSystemObject")
>
> set f=fs.GetFile("e:\slxdbs\Recycle.csv")
>
> f.Copy"e:\slxdbs\New_Recycle.csv",true
>
> set f=nothing
>
> set fs=nothing
>
> Main = DTSTaskExecResult_Success
>
> End Function
>
>



Re: Simple VB Script by Ray

Ray
Tue May 24 14:34:31 CDT 2005

What happens when ~you~ run it? Do you get an error? If so, what is it?
What line? Knowing that you have this scheduled as a SQL job and it's
failing gives us no starting point.

Ray at work

"David VanSickle" <david.vansickle@bcbsne.com> wrote in message
news:%23nP7nRJYFHA.3584@TK2MSFTNGP12.phx.gbl...
> Can someone explain why this fails as a SQL job?
>
>
>
> Thanks
>
>
>
> '**********************************************************************
>
> ' Visual Basic ActiveX Script
>
> '************************************************************************
>
>
>
> Function Main()
>
> dim fs,f
>
> set fs=CreateObject("Scripting.FileSystemObject")
>
> set f=fs.GetFile("e:\slxdbs\Recycle.csv")
>
> f.Copy"e:\slxdbs\New_Recycle.csv",true
>
> set f=nothing
>
> set fs=nothing
>
> Main = DTSTaskExecResult_Success
>
> End Function
>
>



Re: Simple VB Script by Bob

Bob
Tue May 24 15:16:36 CDT 2005

S??I wrote:
> it seems that you are a former C programmer buddy :)
>
> well, vb scripts (unlike Visual Basic and C++,etc) main body is not
> included within functions (eg mail())
> just remove the first line and the last two lines and it will work.

Are you sure? This is a DTS package.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



Re: Simple VB Script by Bob

Bob
Tue May 24 15:18:02 CDT 2005

David VanSickle wrote:
> Can someone explain why this fails as a SQL job?
>

Look at the DTS Package log (use Enterprise Manager) to see if it contains
the error message/number.

There is likely to be a permissions issue - the user account under which SQL
Agent is running may not have permissions to the resources required by this
script.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



Re: Simple VB Script by David

David
Wed May 25 08:42:43 CDT 2005

No, it's not a DTS Job, it's a SQLagent job.

I took out the two lines, and still get an error. I'm using a developers
version of SQL server on my local box, so I have local rights.


"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:%23VdY$1JYFHA.1040@TK2MSFTNGP10.phx.gbl...
> S??I wrote:
> > it seems that you are a former C programmer buddy :)
> >
> > well, vb scripts (unlike Visual Basic and C++,etc) main body is not
> > included within functions (eg mail())
> > just remove the first line and the last two lines and it will work.
>
> Are you sure? This is a DTS package.
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>



Re: Simple VB Script by David

David
Wed May 25 08:46:43 CDT 2005

Ps. I'm new to newsgroups, so please be patient with me.
"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:%23VdY$1JYFHA.1040@TK2MSFTNGP10.phx.gbl...
> S??I wrote:
> > it seems that you are a former C programmer buddy :)
> >
> > well, vb scripts (unlike Visual Basic and C++,etc) main body is not
> > included within functions (eg mail())
> > just remove the first line and the last two lines and it will work.
>
> Are you sure? This is a DTS package.
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>



Re: Simple VB Script by Ray

Ray
Wed May 25 09:38:42 CDT 2005

What error? What line?

Ray at work

"David VanSickle" <david.vansickle@bcbsne.com> wrote in message
news:ekn%23m%23SYFHA.3584@TK2MSFTNGP12.phx.gbl...
> No, it's not a DTS Job, it's a SQLagent job.
>
> I took out the two lines, and still get an error. I'm using a developers
> version of SQL server on my local box, so I have local rights.
>
>
> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:%23VdY$1JYFHA.1040@TK2MSFTNGP10.phx.gbl...
> > S??I wrote:
> > > it seems that you are a former C programmer buddy :)
> > >
> > > well, vb scripts (unlike Visual Basic and C++,etc) main body is not
> > > included within functions (eg mail())
> > > just remove the first line and the last two lines and it will work.
> >
> > Are you sure? This is a DTS package.
> > --
> > Microsoft MVP -- ASP/ASP.NET
> > Please reply to the newsgroup. The email account listed in my From
> > header is my spam trap, so I don't check it very often. You will get a
> > quicker response by posting to the newsgroup.
> >
> >
>
>



Re: Simple VB Script by Bob

Bob
Wed May 25 13:02:44 CDT 2005

David VanSickle wrote:
> No, it's not a DTS Job, it's a SQLagent job.

It's not? Then why does it say this:

Main = DTSTaskExecResult_Success

AFAIK, those DTS constants are only available within DTS packages ...


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.