Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What kind of VB script does DTS actually use? 1

Status
Not open for further replies.

Will192

Technical User
Nov 15, 2002
111
0
0
US
Ok, I am frustrated. I specify my active X object to use VB Script as the language for my code. Half of the VB code that I write won't work in the object. I mean SIMPLE things like the Now() and Date() functions aren't supported. I have done searches on VB script and these functions are suppose to be there. Anyway, here's the code that I am trying to get to work in my DTS job:

Dim TodayDate
Set TodayDate = Now()

I am trying to put the current date and time into a variable. It parses fine, but I get an Error on the second line expecting an object after the equals sign. What the !#$@#$@ is going on? I gotta be missing something simple here.

Thanks in advance for any responses to this post.
 
You just need to remove your 'Set'.

So use this
Code:
Dim TodayDate
TodayDate = Now() 'For Timestamp
'or for Date
'TodayDate = Date()

Hope this helps,

Alex


Professor: But what about your superintelligence?
Gunther: When I had that there was too much pressure to use it. All I want out of life is to be a monkey of moderate intelligence who wears a suit. That's why I've decided to transfer to Business School.
Professor: NOOOOOOOOOOOO.
 
Now it works! Why???? Thanks, but it makes no sense why that would fix it. I have three other lines in that object that use the Set command. All of the code snipets I have found on the web use the Set command to put the date into the variable.

I appreciate the help, but how would I have known to remove the Set command? Very frustrating.
 
As far as your question goes, I think that perhaps set is reserved in vbscript (within the DTS) for SQL server objects such as Global Variables, Data Pump tasks, etc??

I'd be interested to find out if this is actually the case, maybe someone else will be able to shed more light on the subject.

Alex


Professor: But what about your superintelligence?
Gunther: When I had that there was too much pressure to use it. All I want out of life is to be a monkey of moderate intelligence who wears a suit. That's why I've decided to transfer to Business School.
Professor: NOOOOOOOOOOOO.
 
I appreciate the help, but how would I have known to remove the Set command? Very frustrating.

I guess you never would, unless you had been through it before. It certainly doesn't help that the script parses OK with the offending command in there. I have been frustrated by that one before as well.

I really only use VBScript within DTS, so I am not sure if there are the same restrictions on the SET command working with it in other situations. In standard VB you can get away with more liberal use of SET, perhaps you are limited to only using SET when it is actually necessary in VBScript?

Let me know if you find out anything more about this on your own.

Thanks,

Alex



Professor: But what about your superintelligence?
Gunther: When I had that there was too much pressure to use it. All I want out of life is to be a monkey of moderate intelligence who wears a suit. That's why I've decided to transfer to Business School.
Professor: NOOOOOOOOOOOO.
 
I found out from someone else that you can only use the Set command for setting object variables, not for assigning values. I guess I do too much T-SQL instead of VB Script. Oh well. Live and learn. Thanks again for the help.
 
Makes sense. Glad you got it to work, and thanks for the explanation.

Alex


Professor: But what about your superintelligence?
Gunther: When I had that there was too much pressure to use it. All I want out of life is to be a monkey of moderate intelligence who wears a suit. That's why I've decided to transfer to Business School.
Professor: NOOOOOOOOOOOO.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top