1

I have a column(dt) that either contains a date (mo/dd/yr) or a question mark(?). In my where close I'm trying to select only rows where the column has a question mark. I tried the following below and I get an error.

where c.dt = '?'   

The error I get is: SELECT Failed. 3535: A character string failed conversion to a numeric value.

ElGavilan
  • 6,610
  • 16
  • 27
  • 36
T D
  • 143
  • 3
  • 13

1 Answers1

4

The question mark is the string displayed for a NULL ;-)

E.g. this is the default in SQL Assistant and BTEQ.

So dt is actually a DATE column and you need to use:

where c.dt IS NULL

Btw, you can easily change that default:

  • BTEQ: .SET NULL 'whatever';
  • SQLA: Tools -> Options -> Data Format -> Display this string for NULL data values

I usually use <NULL> :)

dnoeth
  • 59,503
  • 4
  • 39
  • 56