LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using scope_identity() in SQL query returns nothing

Dear Folks,

I use the following INSERT/SELECT command combination to retrieve the primary key ID of a record I just inserted:

INSERT INTO PER_SAMPLE_IV_SUMMARY (Test_Config_Summary_ID) VALUES ('2');
SELECT SCOPE_IDENTITY()

It works fine in SQL server enterprise manager.

When I send above SQL commands in DB Tools Execute Query and then use DB Tolls Fetch data, I keep getting nothing in return.

Can someone tell me why/how?

Thanks!
Toutiao

0 Kudos
Message 1 of 2
(2,840 Views)
Hi toutiao,

I know you're presently work with us on this issue through your SSP, but I wanted to throw in my own suggestions on troubleshooting this problem. You can view the subVIs of the Database VIs, such as DB Tools Execute Query and DB Tools Fetch Data. I know you said there's no error returning, but can you determine where the program appears to cause problems? That is, in highlight execution, can you trace through the subVIs where the problem begins?

If we can determine where the DB VIs are having problems we can troubleshoot the primitives at our end.

Cheers.

| Michael K | Project Manager | LabVIEW R&D | National Instruments |

0 Kudos
Message 2 of 2
(2,807 Views)