Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how insert null value in decimal field

Author  Topic 

de4ever@gmail.com
Starting Member

36 Posts

Posted - 2009-01-19 : 01:50:31
HI all,
i am facing problem in inserting null value for a decimal field using open xml .can anybody help

thanks,
de4ever

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-19 : 02:23:13
how is value existing in xml?
Go to Top of Page

de4ever@gmail.com
Starting Member

36 Posts

Posted - 2009-01-19 : 02:43:11
quote:
Originally posted by visakh16

how is value existing in xml?


the value i am passing as 0 and i want to convert 0 to null while inserting database .i.e if column value=0 ,insert null ...
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-01-19 : 03:07:24
INSERT Table1
( Col1, Col2)
SELECT x, NULLIF(y, 0) -- The NULLIF will convert any zero value to null
FROM Table2



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

de4ever@gmail.com
Starting Member

36 Posts

Posted - 2009-01-19 : 04:26:21
quote:
Originally posted by Peso

INSERT Table1
( Col1, Col2)
SELECT x, NULLIF(y, 0) -- The NULLIF will convert any zero value to null
FROM Table2



E 12°55'05.63"
N 56°04'39.26"




Thanks a lot .u saved the day for me...
Go to Top of Page
   

- Advertisement -