Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««1234»»

Using VBScript to Automate Tasks Expand / Collapse
Author
Message
Posted Friday, March 7, 2008 9:00 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 6:46 PM
Points: 36,944, Visits: 31,446
Outstanding primer on VBS and the FSO... well done.

I don't know if I missed it in the article, but for anyone that hasn't used it before, you should have said something to the effect that you can write the code using any text editor, mention that the files can be saved like any text file, and which extensions the operating system expects for VBS files (.vbs or .scr??? Not sure on .scr because I always use .VBS). It would also be handy to empasize a bit that the scripts can be called from any .bat file.

Again, outstanding job and good documented examples.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #466243
Posted Friday, March 7, 2008 9:26 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, January 18, 2013 11:03 AM
Points: 55, Visits: 60
Great point!

Thanks a lot Jeff for the compliment :)



Post #466244
Posted Sunday, March 9, 2008 1:43 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Friday, April 4, 2014 4:40 PM
Points: 751, Visits: 917
Haidong Ji, This is an excellent article and I appreciate the information.

I do have one question though, I have worked with a variety of technologies, but I have not yet used VBS. Why would you want to implement it this way instead of making an actual application or writing it in sql with use of xp command shell?


---
Timothy A Wiseman
SQL Blog: http://timothyawiseman.wordpress.com/
Post #466376
Posted Sunday, March 9, 2008 8:44 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 6:46 PM
Points: 36,944, Visits: 31,446
Heh... I can explain that... since it's a "script", it may not be subject to the normal "code release" steps within a company, it's callable from DTS or SSIS, it's available on every Windows machine, and it's free...

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #466387
Posted Monday, March 10, 2008 11:10 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, February 12, 2014 9:08 AM
Points: 219, Visits: 746
How does the script for deleting old files differ from the Deleting old files in the Maintenance plan?

thanks
Post #466841
Posted Monday, March 10, 2008 11:24 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, January 18, 2013 11:03 AM
Points: 55, Visits: 60
It does the same thing, as far as I can tell.


Post #466848
Posted Monday, March 10, 2008 4:04 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Saturday, August 17, 2013 4:41 PM
Points: 14, Visits: 230
Haidong,

Thanks for posting this article. I've never done any scripting or programming other than SQL. I had a task in my assigned "To Do" list at work that required automating some backup and log deletes. I've been putting it off because I didn't know how to do it other than write some SQL with xpcmdshell and I still wasn't sure exactly how to accomplish it. This article popped up in my email and now it's done! Thank you for knocking something of my tasklist and helping me get over the fear of vbscript!
Post #467014
Posted Monday, March 10, 2008 6:00 PM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Friday, April 4, 2014 4:40 PM
Points: 751, Visits: 917
Thanks Jeff. None of those are issues in my situations, but they make perfect sense for reasons someone might need to use this.

---
Timothy A Wiseman
SQL Blog: http://timothyawiseman.wordpress.com/
Post #467056
Posted Monday, March 10, 2008 6:59 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 6:46 PM
Points: 36,944, Visits: 31,446
Thanks Timothy... That's why I normally don't use VBS scripts... I can do almost everything with T-SQL. :)

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #467069
Posted Monday, March 10, 2008 7:30 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 9:31 PM
Points: 7,135, Visits: 15,141
Nice article...but -

I can't help but ask - why use VBScript when you can use an actual full-featured language? You know - something with actual types, error-handling, etc...?

I mean - in the old days where putting together a full fledged VB6 was a PITA, okay, I could see it. But simple console apps are just as simple to put together, and are oh so very much cleaner to put together....

All right fine - I like VBScript too....But it's almost invariably garbage code because it allows itself to have no form whatsoever....


----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Post #467080
« Prev Topic | Next Topic »

Add to briefcase «««1234»»

Permissions Expand / Collapse