Count)
'Find the name of the table with the ordinal number 8 and display it
MsgBox (myDB.Tables.Item (8).name)
'Disconnect the object from the server
objSQLServer.disconnect
MsgBox ("Ok, server is disconnected")
End Function
Package with an ActiveX Script Task
[ 270 ]
Note: The password will be visible in this script.
Using the SQL DMO Object model many other tasks can be accomplished.
6. In the line item Entry method, type in Main as before.
7. Build the project and execute the ActiveX Script Task component in the
'Canvas'??”"How many Tables?".
The program runs and the first message box shows 57, the number of tables in
this database, and the next message box shows "Poem"??”the name of the table
whose ordinal number is 8. The final message displays that the DMO object was
disconnected from the server. You can verify the above by executing the stored
procedure sys.sp_help in the SQL Server 2005 Management Studio, as shown in
the following screenshot.
Chapter 18
[ 271 ]
Example Three: Navigating to the Internet
Explorer Browser
Step 3: Adding another ActiveX Script Task to
the Project
1. Disable the ActiveX Script Task??”How many Tables?, by right-clicking the
component and choosing Disable.
2. Drag and drop an ActiveX Script Task on to the Canvas from the Control
Flow Items group in the Toolbox.
3. This brings up the ActiveX Script Task Editor window, as described
previously.
4. In the General list item, provide a Name and a Description for the
component.
Pages:
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190