I am new to Vbscript (3 days to be precise),
I am connecting my script to SQL Server and playing around with databases. I have connected successfully
Now here's what I want to do:
I want to store the value of
SELECT COUNT(*) FROM TABLE_A in a variable to be used in VBscript.
This SQL query returns the number of rows in table and it is an integer, but how do I return it and save in a variable?
I tried this:
Dim VARX SET VARX = connection.execute("SELECT COUNT(*) FROM TABLE_A")
VARX should contain the number of rows of
But this is a wrong way I know. And of course It posts an error "TYPE Mismatch:". Please guide me!
Try something like this :
Dim rs, varx SET rs = connection.execute("SELECT COUNT(*) FROM TABLE_A") varx = rs(0).value
Not my field of expertise actually, here are some references :
- VBScript - Retrieving a Scalar Value From a Stored Procedure on SQL Server 2008