Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XML
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 5th, 2004, 10:25 AM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Milan
Default Urgent Help : XML to Sql temporary tables

my xml file is
<Date>05/11/2004
     <UserName> admin
         <FormName>frmErrorReport
             <Procedure>PrcEDIT
                     <ErrorNo>0</ErrorNo>
                     <ErrorDescription />aaaa
             </Procedure>
         </FormName>
     </UserName>
</Date>

i want to convert this in sql server as a temporary table
the sql i used is
************************************************** ******
DECLARE @xmlDoc VARCHAR(8000)
DECLARE @xmlHandle INT
BEGIN
    SET @xmlDoc =
'
     <Date>05/11/2004
     <UserName> admin
         <FormName>ErrorReport
             <Procedure>PrcEDIT
                     <ErrorNo>0</ErrorNo>
                     <ErrorDescription />aaaa
             </Procedure>
         </FormName>
     </UserName>
</Date>


'

    EXEC sp_xml_preparedocument @xmlHandle OUTPUT, @xmlDoc
    SELECT * FROM OPENXML (@xmlHandle, '/Date/UserName/FormName/procedure/errorNo/ErrorDescription',6) WITH
        (
            date1 varchar(20),
            UserName varchar(20),
            FormName varchar(20),
            Procedure1 varchar(20),
                        errorNo varchar(20),
                        ErrorDescription varchar(20)
)

    -- Important to specify this
    EXEC sp_xml_removedocument @xmlHandle
END

*****************************************

its returning only null values

anybody knows the answer plz help


Milan
Reply With Quote
  #2 (permalink)  
Old November 6th, 2004, 06:16 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Your XPath does not match your document in terms of capitalisation, e.g.
Code:
 <Procedure> => /procedure
etc.


--

Joe (Co-author Beginning XML, 3rd edition)
Reply With Quote
  #3 (permalink)  
Old November 6th, 2004, 07:36 AM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Milan
Default

<Date>05/11/2004
     <UserName> admin
          <FormName>frmErrorReport
               <Procedure>PrcEDIT
                     <ErrorNo>0</ErrorNo>
                     <ErrorDescription />aaaa
               </Procedure>
          </FormName>
     </UserName>
 </Date>
actually i need a file like above so can u tell me the correct xpath

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Temporary Tables Challenge! PCNHSL PHP How-To 1 November 8th, 2007 09:42 AM
creating temporary tables instead of queries clwk Access VBA 4 March 12th, 2007 02:50 PM
Crystal Report 8.0 - Working with Temporary Tables deebeedee VB How-To 0 July 27th, 2006 07:30 AM
Temporary tables eadred ADO.NET 4 August 8th, 2005 12:49 AM
Sql Server Temporary Tables itHighway SQL Server 2000 1 July 14th, 2005 12:33 AM



All times are GMT -4. The time now is 05:15 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.