Quick question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JustTrev
    New Member
    • Sep 2009
    • 1

    Quick question

    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.xm l', SINGLE_CLOB)
    AS xmlData
    ) AS feed (xmlData)
    GO
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    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

    Comment

    Working...