2010. 9. 9. 18:34
VB Script를 이용한 SQL 쿼리 Etc.2010. 9. 9. 18:34
VBS, VB Script, SQL, Query
Dim objCN, strConnection
Set objCN = CreateObject("ADODB.Connection")
strConnection = "Driver={SQL Server};Server=.;Trusted_Connection=TRUE"
objCN.Open strConnection
Dim strSQLQuery
strSQLQuery = "USE OperationsManager select * from dbo.AlertView GO"
Dim objRSSet
objRS=CreateObject("ADODB.Recordset")
Set objRS = objCN.Execute(strSQLQuery)
Do Until objRS.EOF
WScript.Echo objRS(0) '첫 번째 컬럼 출력
WScript.Echo objRS.Fields("Id") 'Id 이름의 컬럼 출력
objRS.MoveNext
Loop
objRS.Close
objCN.Close