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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Open Xml bulk Update

Author  Topic 

Sudhindra
Starting Member

13 Posts

Posted - 2009-01-19 : 01:21:08
Hi,
I am sending a XML in string format to my Procedure. I have a Column which takes Null Value. if the Text box is empty I am trying to send Null in the XML. But i keep getting exception unable to convert nnvarchar to numeric.
<Root>
<LValue=''>
<Root>.

IF value
then

<Root>
<LValue='109.00'>
<Root>.

So how can I send Null value in XMl so I can insert Null in the Column. IF i have somevalue in the text box I would like to send it in XML. the column is Decimal.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-19 : 02:33:42
try

<Root>
<LValue xsi:nil="true">
<Root>.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-01-19 : 03:10:30
Or use NULLIF(yourcolhere, '') to get result as NULL.



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

Sudhindra
Starting Member

13 Posts

Posted - 2009-01-19 : 05:57:52
Hey Peso, Thanks, it worked. I used in my SQl procedure NULLIF(LValue,''). Now I am able to insert Records with open xml.
Cannot build a string with LValue xsi:nil="true".
Thanks Again guys for the helping out. Really appreciate it.
Go to Top of Page
   

- Advertisement -