Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss content posted by Wayne Sheffield
»
Loading XML Data into SQL Server (SQL...
49 posts, Page 2 of 5
««
1
2
3
4
5
»
»»
Loading XML Data into SQL Server (SQL Spackle)
Rate Topic
Display Mode
Topic Options
Author
Message
shad-873858
shad-873858
Posted Monday, January 03, 2011 9:57 AM
Forum Newbie
Group: General Forum Members
Last Login: Tuesday, March 13, 2012 10:55 AM
Points: 2,
Visits: 32
gregg_dn (1/3/2011)
I'm getting an the following error when I try to run the OPENROWSET function:
DECLARE @CD TABLE (XMLData XML);
INSERT INTO @CD
SELECT *
FROM OPENROWSET(BULK N'C:\SQL\cd_catalog.xml', SINGLE_BlOB)
Msg 491, Level 16, State 1, Line 5
A correlation name must be specified for the bulk rowset in the from clause.
Is there something in the code beyond SINGLE_BLOB) ?
Thanks
G. Daniels
Yes, as the author noted, you have to provide an alias to the OpenRowset. In his example the author used rs. This will get you past that particular error. Good luck.
Post #1041929
mtillman-921105
mtillman-921105
Posted Monday, January 03, 2011 10:06 AM
Right there with Babe
Group: General Forum Members
Last Login: Friday, May 10, 2013 11:54 AM
Points: 749,
Visits: 3,767
Excellent Wayne, thank you sir!
______________________________________________________________________
The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge. - Stephen Hawking
Post #1041932
gregg_dn
gregg_dn
Posted Monday, January 03, 2011 10:08 AM
SSC Journeyman
Group: General Forum Members
Last Login: Yesterday @ 6:40 AM
Points: 98,
Visits: 221
Thanks!
Post #1041935
WayneS
WayneS
Posted Monday, January 03, 2011 11:55 AM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 1:22 PM
Points: 6,367,
Visits: 8,225
Kelsey Thornton (1/3/2011)
Thanks for this.
It's now clearer.
Kelsey,
Good, I'm glad it all makes sense. If it hadn't, I would have failed.
Wayne
Microsoft Certified Master: SQL Server 2008
If you can't explain to another person how the code that you're copying from the internet works, then
DON'T USE IT
on a production system! After all,
you
will be the one supporting it!
Links:
For better assistance in answering your questions
,
How to ask a question
,
Performance Problems
,
Common date/time routines
,
CROSS-TABS and PIVOT tables Part 1
&
Part 2
,
Using APPLY Part 1
&
Part 2
,
Splitting Delimited Strings
Post #1041993
WayneS
WayneS
Posted Monday, January 03, 2011 11:58 AM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 1:22 PM
Points: 6,367,
Visits: 8,225
paul.marsh (1/3/2011)
decent article - good reference. but I feel a comment about the bcp utility should be added for those situations that warrant a different approach.
Paul - thanks. But how would you use BCP to load an XML file in? (This
is
what this article is about...)
Wayne
Microsoft Certified Master: SQL Server 2008
If you can't explain to another person how the code that you're copying from the internet works, then
DON'T USE IT
on a production system! After all,
you
will be the one supporting it!
Links:
For better assistance in answering your questions
,
How to ask a question
,
Performance Problems
,
Common date/time routines
,
CROSS-TABS and PIVOT tables Part 1
&
Part 2
,
Using APPLY Part 1
&
Part 2
,
Splitting Delimited Strings
Post #1041995
WayneS
WayneS
Posted Monday, January 03, 2011 12:00 PM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 1:22 PM
Points: 6,367,
Visits: 8,225
shad-873858 (1/3/2011)
Yes, as the author noted, you have to provide an alias to the OpenRowset. In his example the author used rs. This will get you past that particular error. Good luck.
Shad - thanks for covering for me.
Wayne
Microsoft Certified Master: SQL Server 2008
If you can't explain to another person how the code that you're copying from the internet works, then
DON'T USE IT
on a production system! After all,
you
will be the one supporting it!
Links:
For better assistance in answering your questions
,
How to ask a question
,
Performance Problems
,
Common date/time routines
,
CROSS-TABS and PIVOT tables Part 1
&
Part 2
,
Using APPLY Part 1
&
Part 2
,
Splitting Delimited Strings
Post #1041996
WayneS
WayneS
Posted Monday, January 03, 2011 12:05 PM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 1:22 PM
Points: 6,367,
Visits: 8,225
Jeff Moden (1/3/2011)
I have to admit, I've not yet had to enter the realm of loading XML files. But now I know where to go for a quick reference. Thanks for filling in the cracks on this one, Wayne!
You're welcome Jeff. Personally, I have to admit that it's pretty nice to be able to
finally
teach you something!
(It's usually you teaching me!
)
Wayne
Microsoft Certified Master: SQL Server 2008
If you can't explain to another person how the code that you're copying from the internet works, then
DON'T USE IT
on a production system! After all,
you
will be the one supporting it!
Links:
For better assistance in answering your questions
,
How to ask a question
,
Performance Problems
,
Common date/time routines
,
CROSS-TABS and PIVOT tables Part 1
&
Part 2
,
Using APPLY Part 1
&
Part 2
,
Splitting Delimited Strings
Post #1041999
WayneS
WayneS
Posted Monday, January 03, 2011 12:10 PM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 1:22 PM
Points: 6,367,
Visits: 8,225
Steve Jones - SSC Editor (1/3/2011)
Excellent discussion, Wayne. This is one that I will keep bookmarked.
mtillman-921105 (1/3/2011)
Excellent Wayne, thank you sir!
gregg_dn (1/3/2011)
Thanks!
Steve, Matt and Gregg - thanks for your kind words, and I'm very glad that you'll found this article so nice.
Wayne
Microsoft Certified Master: SQL Server 2008
If you can't explain to another person how the code that you're copying from the internet works, then
DON'T USE IT
on a production system! After all,
you
will be the one supporting it!
Links:
For better assistance in answering your questions
,
How to ask a question
,
Performance Problems
,
Common date/time routines
,
CROSS-TABS and PIVOT tables Part 1
&
Part 2
,
Using APPLY Part 1
&
Part 2
,
Splitting Delimited Strings
Post #1042005
Geoff A
Geoff A
Posted Monday, January 03, 2011 1:46 PM
SSC-Addicted
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 11:01 AM
Points: 485,
Visits: 1,566
This is great info. Thanks Wayne.
what do you think about making ALL x.data.values to be VARCHAR in the event that the XML is not well formatted?
Post #1042057
WayneS
WayneS
Posted Monday, January 03, 2011 2:12 PM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 1:22 PM
Points: 6,367,
Visits: 8,225
Geoff A (1/3/2011)
This is great info. Thanks Wayne.
what do you think about making ALL x.data.values to be VARCHAR in the event that the XML is not well formatted?
For a standard way of doing things, I would not be in favour of doing that. Plus, it's not really XML if it's not well-formed, is it?
Wayne
Microsoft Certified Master: SQL Server 2008
If you can't explain to another person how the code that you're copying from the internet works, then
DON'T USE IT
on a production system! After all,
you
will be the one supporting it!
Links:
For better assistance in answering your questions
,
How to ask a question
,
Performance Problems
,
Common date/time routines
,
CROSS-TABS and PIVOT tables Part 1
&
Part 2
,
Using APPLY Part 1
&
Part 2
,
Splitting Delimited Strings
Post #1042066
« Prev Topic
|
Next Topic »
49 posts, Page 2 of 5
««
1
2
3
4
5
»
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.