Search blank numeric value from a column SQL Server -
i have numeric column having blank in db table. i'm trying :
select top 10           chqno,        account,        surname,        othrname,        chqamt,        bankno,        pymtno,        glacctno    table1   chqamt = ''     note: chqamt column type decimal
and getting error: error converting data type varchar numeric.
how resolve this?
if chqamt numeric, should check if it's null (blank = '' string)
select top 10         chqno,        account,        surname,        othrname,        chqamt,        bankno,        pymtno,        glacctno    table1  chqamt null;   some simple tests:
create table test1 (num int, string varchar(10)); insert test1 values (null, null); insert test1 values (1, ''); insert test1 values (0, 'zero');   select * test1 num null;   output:
    num string 1   null    null   select * test1 string null;   output:
    num string 1   null    null   -----next 1 (for datatype varchar have different result in oracle, not case)
select * test1 string = '';   output:
    num string 1   1      and @ last:
select * test1 cast(num varchar(10))= '';   output (nothing): think has not meaning.
Comments
Post a Comment