Results 1 to 13 of 13
  1. #1
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6

    Unanswered: For Xml Explicit

    is anybody using this? it looks like a lot of trouble to return a formatted string. I am considering it for something. Any opinions?

    http://technet.microsoft.com/en-us/l...2(SQL.80).aspx

    caution: you have to X out of the Do You Want to Download Silverlight popup.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    I've just used XML Auto.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    that aint going to work here. I have an XSD I put together combined with some sample XMLs that my developer is already writing XSLTs against.

    now its time to get the data out of the database and into memory as xml and the developer is too busy with his one project (and no support or admin duties) to do it, so it goes and lands on my to do list.

    i feel dirty and I need a shower.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  4. #4
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    and I hope said developer is having fun at Mardi Gras this week.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I read all about this crap recently; I'll check my link dumps if I can tonight and get back to you.

    I think you should be using PATH instead of EXPLICIT anyhow...
    George
    Home | Blog

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Oh, and you know you can create XML Schemas, right?
    George
    Home | Blog

  7. #7
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    I have an xsd thanks defining my schema.

    I do see this FOR PATH in BOL. This is SQL 2K.

    Code:
        [ FOR { BROWSE | XML { RAW | AUTO | EXPLICIT } 
                [ , XMLDATA ] 
                [ , ELEMENTS ]
                [ , BINARY base64 ]
            }
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  8. #8
    Join Date
    Nov 2002
    Posts
    272
    I have used it. It works, but I don't quite get it.

  9. #9
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    FOR XML EXPLICIT works, but is an unmaintainable pig. FOR XML PATH is much nicer, but only available on 2005.

    I have long thought that the dunce that came up with FOR XML EXPLICIT needs a spanking.

  10. #10
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    I am still working on SQL 2K, and it took me actually reading the BOL article for 5 minutes, but I am using it. I think I like it. Now if I can only get some time to work on my project.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  11. #11
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    trust me, you will not like it for long.

    are returning an xml blob of any significant complexity, the extra work you need to do to add a single new attribute or element is ridiculous. You have to go and add new rows to EVERY select that you are UNION ALLing together.

    FOR XML EXPLICIT really sucks.

  12. #12
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by jezemine
    FOR XML EXPLICIT really sucks.
    Just helped you out with your typos Jesse. No need to thank me

  13. #13
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    I receive XML and decode it to put it in/update tables

    Code:
    DECLARE @rc int, @error int, @rowcount int, @doc varchar(8000), @idoc int
    SET @doc = '<NL2>'
    	 + '<NewLease2 Type="Relocation" Value="Y"></NewLease2>'
    	 + '<NewLease2 Type="New Facility" Value="Y"></NewLease2>'
    	 + '<NewLease2 Type="Amendment" Value="Y"></NewLease2>'
    	 + '</NL2>' 
    
    EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
    
    CREATE TABLE #myTemp99 (
    		  Type varchar(2000)
    		, Value char(1))
    
    	INSERT INTO #myTemp99 (
    		  Type
    		, Value)
    	SELECT *
    	FROM OPENXML (@idoc, './/NewLease2',3)
    	WITH(
    		 Type varchar(2000) '@Type'
    		,Value varchar(500) '@Value')
    SELECT * FROM #myTemp99
    EXEC sp_xml_removedocument @idoc
    DROP TABLE #myTemp99
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •