Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Must declare scalar variables error
#1
Not Solved MyBB 
Hi,

I need to execute an SQL statement in which I need to declare and intialize variables and inster and update the table accordingly. I am trying the following statement but in vain. I am getting "Must Declare Static variables" Can someone help me in correcting the query


Code:
' This test was created using HP Quality Center

Dim objDB, objResults, objCon
'Create an object for the database connection
Set objDB = CreateObject("ADODB.Connection")


'Enter the Connection string, where the Data Source Name (DSN) is pointed. Create if the DSN is not created
objDB.ConnectionString = "DSN=ABC;UID=XYZ;Description=ABC;APP=QuickTest Professional;WSID=WDRFC;"

'Open the DB Connection
objDB.open

'Declare and set values to variables
strDclr ="DECLARE @Val1 AS VARCHAR(10); DECLARE @Val2 AS VARCHAR(10);"_
&"INSERT INTO db.table([Val1],[Val2],[Val3])"_
&"SELECT @Val1 AS MSISDN,@Val2 AS TREATMENT_ID FROM table  WHERE MSISDN = @Val1 AND Campaign_ID = @val2"_
&"UPDATE Subscriber_A SET Account_ID = @NEW_ACCOUNT_ID WHERE MSISDN = @NEW_MSISDN"

Set objResults = objDB.Execute(strDclr)


Thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Runtime variables details amitmanekar91 0 2,259 03-07-2015, 08:27 PM
Last Post: amitmanekar91
  Using Variables for calling a method in a class chitu576 0 1,783 12-05-2014, 12:31 AM
Last Post: chitu576
  Environment variables _JAVA_OPTIONS and JAVA_TOOL_OPTIONS is preventing java app abhiagarwal42 0 6,492 11-05-2012, 04:21 PM
Last Post: abhiagarwal42
  Debugger loses track of values in Variables deepaksporty 1 4,266 05-26-2012, 01:17 AM
Last Post: Archens
  How to fetch the valid suggestions in to variables venkatbatchu 1 2,216 07-30-2009, 06:19 PM
Last Post: Saket

Forum Jump:


Users browsing this thread: 1 Guest(s)