Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting XML in Stored Procedure to temp table
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01543487
Message ID:
01543585
Views:
36
>>Hi,
>>
>>I am "translating" my VFP stored procedure into a SQL Server stored procedure. The VFP stored procedure receives a couple of small XML files (as strings) and then "deals" with them. How do I convert an XML string file inside SQL Server stored procedure into a temp table? I think that once I have the XML in the temp file I can go on with processing it. Or if you have any other suggestion on how to make an XML string inside SQL Stored procedure as a series of variables, please let me know.
>>
>>TIA.
>
>I found the following example in Stackoverflow that kind of looks similar to my XML file. But I can't figure out how to apply it. Here is an example of the XML they show:
>
>
><?xml version="1.0" encoding="utf-16"?> 
><Users> 
>  <User ID="11005477969327">6/3/2011</User> 
>  <User ID="11034688201594">5/18/2011</User> 
></Users> 
>
>
>And here is an example of someone suggesting to getting the data from the above XML and populating a table:
>
>
>ALTER PROCEDURE dbo.ProcessMailNotificationSentToUsers 
>    @User_XML XML 
>AS 
>BEGIN 
> 
>    INSERT INTO dbo.PasswordExpiryNotificationLog (UserId) 
>        SELECT  
>      Tbl.Col.value('@ID', 'bigint') 
>        FROM 
>           @User_XML.nodes('/Users/User') AS Tbl(Col) 
>END 
>
>
>Since I don't understand the syntax of "Tbl(Col)" I can't figure out how to apply the above code NOT to insert into a table but to simply set values to some variables. If anybody knows how to do it, please let me know. TIA.

Finally figured what was wrong with my code.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform