473,513 Members | 4,753 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

load data from XML to SQL using SP

5 New Member
Hi,

I had created the following SP , now in this sp i am unable to do this , pls help me to do this

Expand|Select|Wrap|Line Numbers
  1. create PROCEDURE searchuserdetail
  2.       @EndUser INT,
  3.       @AdminUser INT
  4. AS 
  5.       DECLARE @ErrorMessage AS VARCHAR(200)
  6.       BEGIN
  7.             BEGIN  
  8.                   SELECT    A.[userid]   ,
  9.                             A.[username] ,
  10.                             B.[userrole],
  11.    B.[BILLING_GRP_CD] AS BillingGroupCd
  12.                   FROM      [dbo].USERDETAIL AS A
  13.                             INNER JOIN A.USERROLE  AS B
  14.                                 ON [A].[USERID] = [b].[USERID]
  15.                   WHERE     [A].[ACTIVE] = 1
  16.  AND  [b].[ROLEID] IN ( @Enduser ,
  17.                                                 @Adminuser )
  18.  
  19.             END  


this sp gets the user information from the two tables userrole and userdetail .
Now in this SP temporary table is created and data from the XML is inserted into the table using SP_XML_PREPAREDOCUMENT
Temporary table has three column that are fieldName ,fieldvalue and operator.Blank Data table is returned and that sql query is stored in variable in order to use this dynamically . No of record from the temptable is counted and stored in a variable . Using while loop combination of field, value and oprator is applied to the where condition in sql Query

Expand|Select|Wrap|Line Numbers
  1. Column name  
  2.  
  3.  
  4. userid            userid maps to the tablemasterid 
  5. username          username maps to the table tablemasterid table 
  6. Status            it is the status of the user that maps to from tablemasterid 



tablemasterid has following coloumn

Expand|Select|Wrap|Line Numbers
  1. userid      username  useraddress      Status 
  2.  
  3. 1           abcd      address1          1 
  4. 2           ghuj      address2          0
Oct 27 '12 #1
3 2752
Rabbit
12,516 Recognized Expert Moderator MVP
You explained what you're doing with your code but you haven't explained what your question is.
Oct 27 '12 #2
Kumarlalit
5 New Member
My question is load the data from xml using temp table into sql server table as pls see the question everthing is explained
Oct 28 '12 #3
Rabbit
12,516 Recognized Expert Moderator MVP
I've read your post. But you explain nothing about your question. You said you used SP_XML_PREPAREDOCUMENT in your stored procedure but it's no where in your stored procedure.
Oct 29 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

14
9725
by: Bruce A. Julseth | last post by:
When I execute this SQL statement in my PHP code, I get an error "File '.\Address.txt' not found (Errcode: 2)" $File = addslashes(".\Address.txt"); $SQL = "Load Data InFile \"" . $File . "\"...
0
6669
by: Donald Tyler | last post by:
Then the only way you can do it that I can think of is to write a PHP script to do basically what PHPMyAdmin is trying to do but without the LOCAL in there. However to do that you would need to...
1
16048
by: Ray in HK | last post by:
What are the differences between LOAD DATA INFILE and LOAD DATA LOCAL INFILE ? I found some web hosting company do not allow using LOAD DATA INFILE but allow LOAD DATA LOCAL INFILE. The reason...
6
3386
by: davvid | last post by:
hello, please I would like to know if it's possible to load data in hierarchical table structure with identity column used as pk (for all the tables) : I mean table root (Id_root(pk,identity...
1
5872
by: Uthuras | last post by:
Greetings, Machine : Pentium IV Os Windows 2000 server Product : DB2 UDB Release : 7.2 We are fail to load the following data file format into db2 database table that has long varchar...
3
6281
by: subaga | last post by:
Hi, I have to load data into a table with one of the columns defined as NOT NULL, but the file does not have data for it. i would like to load a constant value for this column and the constant...
3
2735
by: nsh | last post by:
mailing.database.mysql, comp.lang.php subject: does "LOAD DATA" EVER work?!? I've tried EVERYTHING! version info: my isp is running my web page on a linux box with php ver. 4.4.1 according to...
0
321
by: drec | last post by:
I have a table in which its primary key is auto-incremented. Yet, when I try to load data using load data infile, this column will not auto-increment. I am leaving that column blank in my file to...
0
1934
by: abrahamvk | last post by:
Hi, How to load data into Japanese DB2 Database using DB2 Load Utility, where the table column names are in Japanese in windows environment. We could successfully load Japanese data into a table...
0
2146
by: lanesbalik | last post by:
hi all, right now i'm trying to migrate from db2 running under linux to mysql v5.1. i manage to export out the db2 structure & data into a del (ascii) file. but when i try to load the data...
0
7254
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7519
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5677
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5079
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1585
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.