SQL returns dataset not single value

So this is probably going to be a pretty noobish question, but I tried to summarize as easily as possible in the pictures. Basically I would like system to check this table for an existing record for this work order and retrieve the part number from that table. When I run the change script to detect an entered work order and retrieve the corresponding part number, I get a dataset instead of a single value. How do I tell my SQL to only retrieve the part number and not the column heading?

Also, I would like to make sure that if this returns a null value, that the script does not execute. What would I alter with my change script to make this so?

thanks!

OK I ended up solving this but being new I am sure this is not the most elegant way to do this. Anybody feel like showing me how to optimize this?

image

In the named query configuration where you edit the sql, you can say that the query is a scalar query and then it will return [0][0] by default.

5 Likes

Yup that fixed it, and cleaned up the code quite nicely. Thanks!

1 Like