October 8, 2008 at 11:42 am
Thanks in advance
i am trying to update a table which contains xml type data field
my query is as follows
Update ProductBase
set CrossSell.modify('
')
where CrossSell = 'NULL'
i dont have any idea about what should be the value inside set CrossSell.modify( )
i am trying to update the ProductBase table which contains CrossSell dtafield (xml type) with an inserted value which gets from clr trigger using xmlwriter
please help
October 8, 2008 at 12:01 pm
do you mean
update yourtable
set yourcolumn = ''
where yourcolumn = 'NULL' -- column actually contains value NULL
or
update yourtable
set yourcolumn = ''
where yourcolumn is NULL -- column actually is NULL i.e. unknown value
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
October 8, 2008 at 12:07 pm
in my ProductBase table the CrossSell field contains null value
October 8, 2008 at 2:04 pm
Continuing the cross-posted thread from here: http://www.sqlservercentral.com/Forums/Topic582839-149-1.aspx#bm582875
anupamabr,
If when you select the XML value, it returns the word NULL, it means that there is no value. If you inserted the value 'NULL' into an XML datatype and then selected it, you'd get a blank value returned.
So, what this means is that you need to change you comparison from = 'NULL' to IS NULL.
October 8, 2008 at 2:35 pm
still iam getting the same error
thanks for your quick response
October 8, 2008 at 2:57 pm
If it is NULL, why not just set it to the new XML value without going through the XML DML?
DECLARE @ProductBase TABLE (ID int IDENTITY(1,1), CrossSell xml)
INSERT INTO @ProductBase
DEFAULT VALUES
SELECT * FROM @ProductBase
Update @ProductBase
set CrossSell = ' '
where CrossSell IS NULL
SELECT * FROM @ProductBase
October 8, 2008 at 7:20 pm
Thanks alot Jhon...it is working nw.....
thanks again
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply