Is there a way I can send a NULL value to a SQL stored proc through XML? -


I'm thinking that in a way I can send a tap or dibbon to my C # data service. Proc through some configuration xml parameter

In the proc, I want to draw some value of xml as a bit, but because the UI allows for the third position, the bit can come from the val xml in which case i have any I also want to ignore the SQL update.

  Excelment xml = new excelment ("XML"); Xml.Add (New XElement ("SomeConfigValue", NULL));  

It seems that when I put zero in the XML from C #, it does not miss a node with a value.

  & lt; SomeConfigValue / & gt;  

When I catch the value from XML as a value in SQL, the value is interpreted as 0. Choose

  isnull (@configuration .value ('/ configuration [1] / some config value [1]', 'bit'), NULL)  

It's all right and good. It makes sense. I'm just curious if someone can suggest suggestions from which I want to do it, I can get it to work. Maybe I can not rely on the SQL bit type, but I'm currently strongly typing Factoring again for

If a value is not going to be 1 or 0

  set @SomeConfigValue = isnull (@configuration.value ('/ configuration [1] / some config value [1] ] ',' Bit '), tap)  

Its goal is to ignore the updating of that specific value if it is zero, or in case of this specific SQL bit type 1 or 0 is not.

  Update MyTable configure ConfigValue = case @SomeConfigValue IS NULL, then T.SomeConfigValue else @ SomeConfigValue ends with some Table T  

The method used by standard XML serialization here - XElement does not have the same asset, but you can add the "xsi: nil" attribute by itself , And can test against it in processed proc.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -