LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL SELECT does not return all values

Hey,

i try to select values from my database.

My problem is, i do not get all values from a few tables.

 

i've seen a similar problem at this post.

 

https://forums.ni.com/t5/LabVIEW/SQL-query-does-not-return-results/m-p/4103624#M1182428

 

If i Put "SET NOCOUNT ON;" i get the same results as before

setnocountoff.PNG

setnocounton.PNG

 

does anyone have an idea?

0 Kudos
Message 1 of 8
(4,255 Views)

Hi!

 

Your Query DOES return data, if you look at the probe.

The result has two rows and six columns, from which only the first and last contain data: 

 

| 702 |   |   |   |   |  costa |

| 704 |   |   |   |   |  asd   |

 

What do you get when you run the query with an other database client? Are those fields NULL ?

NULL means there is absolutely nothing in the field. Not a number of value 0, not an empty string, just nothing.

In LV, this translates to an empty variant.

Maybe, this columns have a weird data type?

0 Kudos
Message 2 of 8
(4,218 Views)

i did not test other clients, the weird thing is other table get loaded completely and some do not.

the data type is the same - int or strings. for all my tables.

if I select just column per column, i get all values. But if I try to select a hole row i get some empty cells..

 

 

0 Kudos
Message 3 of 8
(4,193 Views)

Hi!

 

It is hard to say if there is a problem with Labview, if you don't know what the real result from the DB is.

Therefore, please use a client like Microsoft SqlServer Management Studio or similar, and run the same query there.

It is entirely possible that labview shows the result correctly, but the result is different from what you expect.

0 Kudos
Message 4 of 8
(4,176 Views)

i've tried the same query in managament studio - i get all values. Just in Labview i do not get all values

0 Kudos
Message 5 of 8
(4,165 Views)

Give us some more information here... What is the output supposed to look like? How many rows are there supposed to be?

 

Try doing a SELECT count(*) on the table and see if the result is 2 or the correct number of rows.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 6 of 8
(4,159 Views)

here are the results 

 

test1.PNG

 

test2.PNG

I do not get the same reslults by the same query.

if i replace the "NO COUNT ON " with "SET NOCOUNT OFF"  i get an error message

 

I also tried to select the values just per coulmn and then i get the missing values

test3.PNG

this shows one of the missing columns

0 Kudos
Message 7 of 8
(4,143 Views)

Can you share your (example?/real) LabVIEW code?

It certainly seems like something odd is happening, but the screenshots of the probe window don't allow much in the way of debugging.

The linked forum thread discusses using the Fetch All + Next Recordset options - given you know you have 2 results (I suppose), you might be able to do that instead of the SET NOCOUNT ON toggle.

If you know the number of recordsets (seemingly SELECT statements) then you might not need the 'fix' (quotes because I don't know if it has either a) since been fixed officially, or b) been obviated in some other way) mentioned by DavidBoyd.


GCentral
0 Kudos
Message 8 of 8
(4,138 Views)