February 20, 2009 at 3:51 pm
Hi I am trying to add the XML file contents to the my Database.
My code are as follow:-
INSERT INTO rssFeeds (feedName, feedXML)
SELECT 'MSDNRSS3',xmlData FROM (SELECT * FROM OPENROWSET (BULK 'C:\Temp\rss.xml', SINGLE_CLOB) AS xmlData) AS feed (xmlData)
SELECT * from rssFeeds
this all works fine but my requirement is the updation part. i need to update the xml column with the new data added to the xml file..
When i am trying to add the WHERE Clause here it is not recognizing the column..
Like :-
INSERT INTO rssFeeds (feedName, feedXML)
SELECT 'MSDNRSS3',xmlData FROM (SELECT * FROM OPENROWSET (BULK 'C:\Temp\rss.xml', SINGLE_CLOB) AS xmlData) AS feed (xmlData)
WHERE feedName='xxxxxxxx'.
here it showing invalid column name 'feedName'
Any clue.
Thanks & Regards,
Syed
February 22, 2009 at 8:05 am
The function OPENROWSET with the provider bulk, returns to the client one column only. If I’m not mistaken the name of this column is BulkColumn. In any case I’m sure that the column is not called FeedName, so the server has no knowledge about this column that you use in the where clause. Also it is hard to understand your query. Can you check if the version that I wrote bellow returns the same data (if you omit the where clause that isn’t working from your version).
INSERT INTO rssFeeds (feedName, feedXML)
select 'MSDNRSS3', BulkColumn
from OPENROWSET (BULK 'C:\Temp\rss.xml', SINGLE_CLOB) AS xmlData
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
February 23, 2009 at 7:56 am
It does work but i want to apply the condition here.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply