Friday, November 20, 2009
Home Retrieving XML Writing XML General Contact About  

How can I insert data into a table that uses a different number of columns than my table?  (9324 Requests)

You have to specify a colpattern. Follow this link and scroll down to section B.

Feedback

# Problem if using a Where clause Brett Morgan

While the colpattern works great if you want to select all the columns, it breaks down when you have a Where clause. You can't have a column in the where clause that is not in your colpattern, so you resultset will include this column, therefore is won't insert. I got around this by inserting into a temp table and then selecting want I needed from that. Not idea.

# Problem if using a Where clause Bryant

To get around the limitation of having to specify a column that you don't want to insert, you can filter out the values you don't want by using XPath. See this faq for more info: http://sqlxml.org/sqlxml/faqs.xml?faq=60

# Problem if using a Where clause Simon

I would strongly recommend that an filtering on the XML should be done in the rowpattern. The performance of the OPENXML statement is directly related to the rows returned and the columns returned

# Problem if using a Where clause Simon

Further more you can still return a column in the OPENXML rowset and not specify it in the SELECT clause, i.e do not use SELECT *

# re: How can I insert data into a table that uses a different number of columns than my table? dude

The link to the doc is broken.

# jcsxburtg fucahvytz uhmsevygj@mail.com

dhqr efbakmx fnmzgopwq hrcdg jdcakt toun suvpa

Title  
Name  
Url
Comments   


FAQ #4

last updated:
6/6/2001


Did the information in this faq help answer your question?





 
 

Survey Results: 5
Yes No N/A

© 2001, 2002, 2003 sqlxml.org