NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Teststand database error - Error converting data type nchar to int.

Solved!
Go to solution

Hi,

 

I have used the standard SQL stored procedure database options to store my test records and I have added the generated tables and stored procedures to an exisitng database and it seems to run OK in this form. However when I ammend the UUT_Results table to include a new column which contains the primary key value from another table in the database I run into problems.

 

I execute a query which returns the primary key value (integer) for a given serial number and stores this result as a station global (number format). The correct value is being stored in the variable, but when I attempt to use this value in the stored procedure I get an error as below:

 

An error occurred calling 'LogResults' in 'ITSDBLog' of 'zNI TestStand Database Logging'
An error occurred executing a statement.
Schema: SQL Server Stored Proc (NI)
Statement: UUT_RESULT.
Description: Error converting data type nchar to int.
Number: -2147217913
NativeError: 8114
SQLState: 22018
Reported by: Microsoft OLE DB Provider for SQL Server

Source: TSDBLog

 

My SQL statement for the creation of the table and procedure for UUT_results is below:

 

 ~
CREATE TABLE UUT_RESULT (
ID uniqueidentifier PRIMARY KEY,
BoardDetailID int,
STATION_ID varchar(255),
BATCH_SERIAL_NUMBER varchar(255),
TEST_SOCKET_INDEX int,
UUT_SERIAL_NUMBER varchar(255),
USER_LOGIN_NAME varchar(255),
START_DATE_TIME datetime,
EXECUTION_TIME float,
UUT_STATUS varchar(32),
UUT_ERROR_CODE int,
UUT_ERROR_MESSAGE varchar(255)
CONSTRAINT UUT_RESULT_FK FOREIGN KEY (BoardDetailID) REFERENCES BoardDetails)

~
CREATE PROCEDURE InsertUUTRESULT
@pID uniqueidentifier,
@pBoardDetailID int,
@pSTATION_ID varchar(255),
@pBATCH_SERIAL_NUMBER varchar(255),
@pTEST_SOCKET_INDEX int,
@pUUT_SERIAL_NUMBER varchar(255),
@pUSER_LOGIN_NAME varchar(255),
@pSTART_DATE_TIME datetime,
@pEXECUTION_TIME float,
@pUUT_STATUS varchar(32),
@pUUT_ERROR_CODE int,
@pUUT_ERROR_MESSAGE varchar(255)
AS
INSERT INTO UUT_RESULT ( ID,BoardDetailID,STATION_ID,BATCH_SERIAL_NUMBER,TEST_SOCKET_INDEX,UUT_SERIAL_NUMBER,USER_LOGIN_NAME,START_DATE_TIME,EXECUTION_TIME,UUT_STATUS,UUT_ERROR_CODE,UUT_ERROR_MESSAGE)
VALUES (
@pID,
@pBoardDetailID,
@pSTATION_ID,
@pBATCH_SERIAL_NUMBER,
@pTEST_SOCKET_INDEX,
@pUUT_SERIAL_NUMBER,
@pUSER_LOGIN_NAME,
@pSTART_DATE_TIME,
@pEXECUTION_TIME,
@pUUT_STATUS,
@pUUT_ERROR_CODE,
@pUUT_ERROR_MESSAGE)

 

Any help would be much appreciated,

 

Thanks

 

Stuart

0 Kudos
Message 1 of 4
(4,350 Views)
Solution
Accepted by topic author Stuart_M

Stuart -

What is the expression that you are evaluating and the data type of the parameter that you have defined in the Database Options dialog box for the schema you are logging data with?

Scott Richardson
https://testeract.com
Message 2 of 4
(4,336 Views)

Hi Scott,

 

It looks like that is my problem. The BoardDetailsID paramater does not appear in the list of the UUT_Result parameters for my schema. I willhave to see if I can figure out how to add it.

 

Thanks

 

Stuart

0 Kudos
Message 3 of 4
(4,330 Views)

Hi Scott,

 

Problem solved. I have added the parameter and all works well now.

 

Thanks

 

Stuart

0 Kudos
Message 4 of 4
(4,321 Views)