Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Using VBScript to Automate Tasks


Using VBScript to Automate Tasks

Author
Message
Michael Shorkey
Michael Shorkey
Grasshopper
Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)

Group: General Forum Members
Points: 21 Visits: 133

Is this in a .BAT or .SCR file?


Ben Dizenhouse
Ben Dizenhouse
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 1

I just want to say thank you for posting this article.  It was real easy to read, understand and modify for my own use.  There are a lot of coders out there that can write really good code, but it takes another skill to write code as you have done that is easy to read and adapt.

 

Thanks,

Ben


Haidong Ji
Haidong Ji
Valued Member
Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)

Group: General Forum Members
Points: 55 Visits: 60
Wow, I never thought that my little article generated so many great feedbacks! I learned so much from you all!!!

Sorry for the late reply to all you guys. I've been busy with other things and have neglected checking back the forum from time to time.

Thanks again.



pl-272086
pl-272086
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 1

Forfiles is a little known command that is great for iterating over a number of files that meet a condition, it's available in both 2000, XP and 2003 but there are different versions out there depending on servicepack version.  

For example, I use it in a backup script to remove local backups when they have been moved to network drive:

' Delete cab files older than 3 days in local folder
oWshShell.Run "FORFILES /p ""C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup"" /m *.cab /d -3 /c ""cmd /c del @file""" , 0, True

For all command line options run FORFILES /? on the command prompt.


Haidong Ji
Haidong Ji
Valued Member
Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)

Group: General Forum Members
Points: 55 Visits: 60
Very cool pl! Thanks for sharing.



Warren Ball
Warren Ball
Forum Newbie
Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: General Forum Members
Points: 2 Visits: 1

The following questions are for script#2.

1) When the FTP script is run, what does the '-s' represent, send a single file?

2) Is there a way to make the DOS screen freeze when the FTP script is being run?  I've tried 'pause', 'prompt', 'echo', etc. but nothing seems to work.

3) How can a logfile be created when the FTP script is run?  I've used the Chr to put the ascii '>>' characters in but a logfile is not created.

Thanx!     Warren

          


Charlie Whitcraft-242308
Charlie Whitcraft-242308
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 29
I need this funcionality, but I have not done VBScript with SQL Server before.
Where do you put this code? Do I bring up SQL Mgmt Studio and then what?
Can you point me to a resource?
Thanks. CW
Jerry Hung
Jerry Hung
Right there with Babe
Right there with Babe (794 reputation)Right there with Babe (794 reputation)Right there with Babe (794 reputation)Right there with Babe (794 reputation)Right there with Babe (794 reputation)Right there with Babe (794 reputation)Right there with Babe (794 reputation)Right there with Babe (794 reputation)

Group: General Forum Members
Points: 794 Visits: 1208
Pretty cool neat VBS
I am playing with them already

I suppose SSIS/Batch can work equally well for the same thing

SQLServerNewbie

MCITP: Database Administrator SQL Server 2005
Haidong Ji
Haidong Ji
Valued Member
Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)Valued Member (55 reputation)

Group: General Forum Members
Points: 55 Visits: 60
You can put it in a Sql Server Agent job. Create a new job, go to steps, and pick ActiveX script from the dropdown.



SanjayAttray
SanjayAttray
Hall of Fame
Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)

Group: General Forum Members
Points: 3953 Visits: 1619
Delete files in a folder that are certain days old script is worth keeping in personal briefcase. Thanks for a good article.

SQL DBA.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search