datatable select unusual syntax problem

  • Thread starter Thread starter Bernie Yaeger
  • Start date Start date
B

Bernie Yaeger

I'm trying to identify a col in sql that is empty when calling the select
method of a datatable. For example:
For Each irow In dsspship.Tables(0).Select("(qrange_e - qrange_s) > 0 and
len(pubcode) > 0")

This doesn't work - if a row's qrange_e - qrange_s is greater than 0, I get
the row, even though pubcode is empty. When I change it:

For Each irow In dsspship.Tables(0).Select("(qrange_e - qrange_s) > 0 and
len(ltrim(pubcode)) > 0")

I get an error. Interestingly, both work just fine in sql query analyzer,
so there is clearly a difference between qa's acceptable syntax and the
..select method's syntax. Anyone know how to specify 'empty' (char variable)
in the select method?

Thanks for any help.

Bernie Yaeger
 
OK, kinda figured it out, but it's very strange:

You can use trim() inside a datatable .select but it is not recognized in
t-sql; on the other hand, ltrim() is recognized in t-sql but not in a
datatable .select; therefore, inside vb .net, this works:

For Each irow In dsspship_.Tables(0).Select("(qrange_e - qrange_s) >
0 and len(trim(pubcode)) > 0")

whereas this doesn't:

For Each irow In dsspship_.Tables(0).Select("(qrange_e - qrange_s) >
0 and len(ltrim(pubcode)) > 0")

(but this latter works in t-sql but the former does not).



Now the bigger question - is there any place I can go to get a full list of
syntactic differences?



Bernie
 
Back
Top