Im not sure what you mean by converting the string to an VBscript
... Like the Ansgar Wiechers said, the string remains the same, the environment changes
anyway...
Place this code in notepad.exe
edit the connection string to suit your server
save file with .vbs
extension
locate it and run it!
Const adUseClient = 3
Dim cn
Set cn = CreateObject("ADODB.Connection")
dim sql
sql = "SELECT distinct CASE " & _
"WHEN enty_typ_cd = 'acct' THEN 'Account : ' " & _
"WHEN enty_typ_cd = 'pfolio' THEN 'Portfolo : ' " & _
"END + a.mstr_shrt_nm_id as [ ] " & _
"FROM RCMglbl..nav_nt a, RCMglbl..enty_mstr b " & _
"WHERE a.enty_id = b.id AND office = 'sf' " & _
"AND mnth_end_dt <> (select lst_mo_end_dt from RCMglbl..proc_dt) " & _
"AND mnth_end_dt is not NULL"
with cn
.CursorLocation = adUseClient
.Open "Driver={SQL Server};Server=SERVER_NAME; Database=DATABASE_NAME; UID=USER_ID_NAME; PWD=PASSWORD"
.CommandTimeout = 0
.Execute(sql)
end with
cn.close
set cn = Nothing
Once you get that working, youve gotta think about the result your getting from your query... therefore, i advise on reading more about SELECT STATEMENT and possibly a RECORDSET