Client Management Suite

 View Only

SQLtoVBS.VBS -An incy script to convert a T-SQL to VBScript string 

Jan 26, 2015 03:08 PM

Today's download is one I use a lot. It's a script which converts a text file containing raw T-SQL to a format more readily consumed by programming code. I do a lot of task automation that embeds T-SQL, and this little script is invaluable.

Using the Windows explorer drag and drop file action, this script enables me to instantly convert a T-SQL script file which looks like this below,

DECLARE    @return_value int,
        @query as nvarchar (4000),
        @myHTML nvarchar(max),
        @bit1green as nvarchar (4000),
        @bit1amber as nvarchar (4000),
        @bit1red as nvarchar (4000),
        @bit2 as nvarchar (4000),
        @bit3 as nvarchar (4000)

 

To a file whose contents contain the T-SQL, but in a programatically embedded form like this,

squery= "DECLARE    @return_value int,"
squery=squery & "        @query as nvarchar (4000),"
squery=squery & "        @myHTML nvarchar(max),"
squery=squery & "        @bit1green as nvarchar (4000),"
squery=squery & "        @bit1amber as nvarchar (4000),"
squery=squery & "        @bit1red as nvarchar (4000),"
squery=squery & "        @bit2 as nvarchar (4000),"
squery=squery & "        @bit3 as nvarchar (4000)"

 

Very simple, but also quite handy.

To use, just drag your plain text file containing your crafted SQL onto the script and then within moments you'll see you converted file appear with an additional .vbs extension.

Kind Regards,
Ian./

 

 

Statistics
0 Favorited
0 Views
2 Files
0 Shares
0 Downloads
Attachment(s)
zip file
SQLtoVBS.zip   1 KB   1 version
Uploaded - Feb 25, 2020
zip file
SQLtoVBS_v1.1.zip   1 KB   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Comments

Feb 04, 2015 08:32 AM

Updated today to v1.1 (when i prettied up the script for Connect I gave it a bug)....

 

Related Entries and Links

No Related Resource entered.