NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to format SQL procedure with multiple parameters

Need to call a procedure from teststand and having problems formating the statement.  Here's the statement and the type paramenters needed.

EXECUTE dbo.GetAddress (Name),startnumber,endnumber,serial

 

Name = String

startnumber = int

endnumber = int

serial = string

so what works in sql is this statement EXECUTE dbo.GetAddress 'NW',100,105,'2001'

So i'm having problems with where to put the single and double quotes.

Trying to do this

EXECUTE dbo.GetAddress  FileGlobals.StyleParse["CustomLabels"].CustomerName,Val(FileGlobals.StartAddress), Val(FileGlobals.EndAddress),FileGlobals.SerialNumber

0 Kudos
Message 1 of 3
(3,391 Views)

Hi hallawt,

 

Take a look at the knowledgebase article below that discusses how to build SQL Statements. Admittedly this is not straightforward so if you have any questions regarding this article or are still having trouble please let me know.

 

http://digital.ni.com/public.nsf/allkb/BC46654FA87D130E8625695A0000932B?OpenDocument

Patrick H | National Instruments | Software Engineer
0 Kudos
Message 2 of 3
(3,372 Views)

Read the article, it does not help much when dealing with multiple parameters, as stated the procedure is looking for four parameters, with three as must be present, start, end and serial.

Was told to Open SQL statement frist with the EXECUTE command, then perform a data operation, got an error when that method was used.

See below for setup information.

Settings 

 Open statement

Data operation setup

Data operation parameters         

  

Got the following error executing the steps below:

Details:

Native error code -2147217900 0x80040e14

Microsoft SQL Native Client:

    Syntax error, permission violation, or other nonspecific error

 

Error Code:  -10; User-defined error code.

 

Location:  Step 'Data Operation' of sequence 'Get Next Available Address' in 'LCR5200_4700 FT.seq'

 

Download All
0 Kudos
Message 3 of 3
(3,367 Views)