Connecting Tech Pros Worldwide Help | Site Map

Quick question

Newbie
 
Join Date: Sep 2009
Posts: 1
#1: Sep 11 '09
Hi

I have a quick question. I'm studying how XML works in sq server 2005, and I've hit the following code online that I can't completely understand (see below code).
I know what it does, how it works, but it's just the part "AS feed (xmlData)" that I'm trying to fully understand. I get the 'As feed' is an alias,but why must the (xmlData) be there?
If anyone can answer this (i'm asuuming simple question!) I would greatly appreciate it.

Thanks.

INSERT INTO rssFeeds (feedName, feedXML)
SELECT 'MSDNRSS', xmlData FROM
(
SELECT * FROM OPENROWSET
(BULK 'C:\Temp\rss.xml', SINGLE_CLOB)
AS xmlData
) AS feed (xmlData)
GO
ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,925
#2: Sep 12 '09

re: Quick question


It's a column alias. As you can see, the outer SELECT used xmlData. That xmlData is the same xmlData used in the alias. Read the FROM part of the select here.

Happy Coding!!!

--- CK
Reply