Skip to main content

Posts

Showing posts with the label MSSQL

VBScript for compressing files in a folder and send on FTP

This is a simple vbscript compression script. works flawlessly on text files even bigger than 15GB. We have a SSIS data generation package installed on our DB server which generates huge data files for data mining operations for current year, current month. The below scripts are doing the rest; compress the files and FTP to the data mining server location.   '====================================================== ' Function : Zip datamart CSV, CTL files to local server for archive purposes. '====================================================== Function WindowsZip(sFile, sZipFile, szPath, szDate)   Set oZipShell = CreateObject("WScript.Shell")    Set oZipFSO = CreateObject("Scripting.FileSystemObject")   Set LogFile = oZipFSO.CreateTextFile(szPath & "\Logs\log_" & szDate & ".log", true)   LogFile.WriteLine("=======================================")   LogFile.WriteLine(Now & " - Com...

MSSQL Split, Pad Zeroes, Get Alphabets, and Substring

Got a request to create a data table get from some existing data to some required data formatting. The Source data is like 'C10 L1_B21773197D.xls', 'EV1 L1_B21773602F.xls', 'EV116 L1_B21773659G.xls', etc. The following were the requirements. CategoryCode No NVARCHAR(10) C Contained in legacy data file name Sample legacy data file name : “ C 10 L1_B21773197D ” 1.        Alphabets prior to Numeric characters) FolderNo No VARCHAR(10) C001 Contained in legacy data file name Sample legacy data file name : “ C 10 L1_B21773197D ” 1.        convert numeric characters prior to “white space” to a 3 digit number (e.g. “1” --> “001”) 2.        Append 3 digit number to Category Code VolumeNo No VARCHAR(10) C001L01 Contained in legacy data file name Sample legacy data file name : “ C10 L1_B21773197D ” ...