Mittwoch, 5. Dezember 2012

SSIS vb-ScriptTask Select

Public Sub Main()

Dim sql As String
Dim connStr As String = "server=SERVER\INSTANCE;integrated security=true;MultipleActiveResultSets=True;database=SCHEMA"
Dim status As String

Using Connection As New SqlConnection(connStr)
Connection.Open()

Dim command As SqlCommand = Connection.CreateCommand()

Try
sql = " SELECT * "
sql = sql & " FROM TABLE_A "
sql = sql & " WHERE ... "

command.CommandText = sql

status = command.ExecuteScalar()
Connection.Close()
Catch ex As Exception
Dts.Events.FireInformation(130, "..... ", "err: " & ex.ToString, "", 0, True)
End Try
End Using

End Sub

Keine Kommentare:

Kommentar veröffentlichen