|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to figure this one out - "The isnull function requires 2 argument(s)"In SS EE I have nulls in a column. I want to select and eventually change to a zero (its a smallint column). I've tried selecting 'null', 'dbnull', etc. Then I read about the ISNULL function. From the example I got, I received the "...requires 2 arguments...." error. Read up on it but it doesn't click with me. Could someone explain the error? And secondly, how to select null fields? Thanks, Hexman ====================== Code Below ================ use CNDB select * from cnmaster where isnull(cnpick) Msg 174, Level 15, State 1, Line 3 The isnull function requires 2 argument(s) Hello Hexman,
SELECT * FROM Table WHERE Field IS NULL The change to zero SQL looks like: UPDATE Table SET Field = 0 WHERE Field IS NULL The ISNULL function converts a null value into a non-null value.. so.. SELECT Field AS NullField, ISNULL(Field, 0) AS NotNullField FROM Table ....would return ALL records, but report any null values in Field as zero, without changing the underlying data. ISNULL() is a reporting function.. not a data changing function. -Boo Show quoteHide quote > Hello All, > > In SS EE I have nulls in a column. I want to select and eventually > change to a zero (its a smallint column). I've tried selecting > 'null', 'dbnull', > > etc. Then I read about the ISNULL function. From the example I got, > I received the "...requires 2 arguments...." error. Read up on it but > it > > doesn't click with me. > > Could someone explain the error? And secondly, how to select null > fields? > > Thanks, > > Hexman > > ====================== Code Below ================ > use CNDB > select * from cnmaster > where isnull(cnpick) > Msg 174, Level 15, State 1, Line 3 > The isnull function requires 2 argument(s) Works beautifully! Thanks a bunch.
Hexman On Fri, 29 Sep 2006 04:35:55 +0000 (UTC), GhostInAK <ghosti***@gmail.com> wrote: Show quoteHide quote >Hello Hexman, > >SELECT * FROM Table WHERE Field IS NULL > >The change to zero SQL looks like: >UPDATE Table SET Field = 0 WHERE Field IS NULL > >The ISNULL function converts a null value into a non-null value.. so.. >SELECT Field AS NullField, ISNULL(Field, 0) AS NotNullField FROM Table >...would return ALL records, but report any null values in Field as zero, >without changing the underlying data. > >ISNULL() is a reporting function.. not a data changing function. > >-Boo > >> Hello All, >> >> In SS EE I have nulls in a column. I want to select and eventually >> change to a zero (its a smallint column). I've tried selecting >> 'null', 'dbnull', >> >> etc. Then I read about the ISNULL function. From the example I got, >> I received the "...requires 2 arguments...." error. Read up on it but >> it >> >> doesn't click with me. >> >> Could someone explain the error? And secondly, how to select null >> fields? >> >> Thanks, >> >> Hexman >> >> ====================== Code Below ================ >> use CNDB >> select * from cnmaster >> where isnull(cnpick) >> Msg 174, Level 15, State 1, Line 3 >> The isnull function requires 2 argument(s) > > |
|||||||||||||||||||||||