Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Pushing data from XML to Sybase tables

2 posts in General Discussion (old) Last posting was on 2008-05-26 13:28:32.0Z
Nikhil Bhandari Posted on 2008-05-26 11:06:22.0Z
From: "Nikhil Bhandari" <Nikhil_Bhandari@intuit.com>
Newsgroups: sybase.public.sqlanywhere
Subject: Pushing data from XML to Sybase tables
Date: Mon, 26 May 2008 16:36:22 +0530
Organization: Aioe.org NNTP Server
Lines: 16
Message-ID: <g1e5he$h3s$1@aioe.org>
NNTP-Posting-Host: FGNgxYIhqxE26H1CfHDv8Q.user.aioe.org
X-Complaints-To: abuse@aioe.org
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-Priority: 3
X-MSMail-Priority: Normal
Path: forums-1-dub!forums-master!newssvr.sybase.com!news-sj-1.sprintlink.net!news-peer1.sprintlink.net!newsfeed.yul.equant.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!nlpi057.nbdc.sbc.com!prodigy.net!feeder.erje.net!aioe.org!not-for-mail
Xref: forums-1-dub sybase.public.sqlanywhere:86
Article PK: 866536

Hi All,
I am using Sybase (SQL Anywhere 10) and have got some data in a XML file
(say a huge number of name-value pairs) which I want to directly push into
Sybase table. Corresponding table is already created and I can do the same
by parsing the XML and then executing multiple "insert" statements but I
want to avoid that. Could not find much on Google yet.

I am using C# (there is something called SqlBulkCopy in .Net but the
destination database has to be SQL Server 2005).

Any help/ pointers would be appreciated.

Thanks,
Indian.


Breck Carter [sqlanywhere.blogspot.com] Posted on 2008-05-26 13:28:32.0Z
From: "Breck Carter [sqlanywhere.blogspot.com]" <NOSPAM__breck.carter@gmail.com>
Newsgroups: sybase.public.sqlanywhere
Subject: Re: Pushing data from XML to Sybase tables
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__breck.carter@gmail.com
Message-ID: <2mel34dqcekqtckh2mdh4jedi12177m3rp@4ax.com>
References: <g1e5he$h3s$1@aioe.org>
X-Newsreader: Forte Agent 2.0/32.640
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 26 May 2008 06:28:32 -0700
X-Trace: forums-1-dub 1211808512 10.22.241.152 (26 May 2008 06:28:32 -0700)
X-Original-Trace: 26 May 2008 06:28:32 -0700, vip152.sybase.com
Lines: 37
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.sqlanywhere:87
Article PK: 866535

The short answer is...

Step 1: Call xp_read_file() to load the XML data into a local LONG
VARCHAR string variable.

Step 2: Execute INSERT t SELECT ... FROM OPENXML() to parse the XML
and load the table.

The longer answer is...
http://sqlanywhere.blogspot.com/2008/04/openxml-rocks.html

Breck

On Mon, 26 May 2008 16:36:22 +0530, "Nikhil Bhandari"

<Nikhil_Bhandari@intuit.com> wrote:

>Hi All,
>I am using Sybase (SQL Anywhere 10) and have got some data in a XML file
>(say a huge number of name-value pairs) which I want to directly push into
>Sybase table. Corresponding table is already created and I can do the same
>by parsing the XML and then executing multiple "insert" statements but I
>want to avoid that. Could not find much on Google yet.
>
>I am using C# (there is something called SqlBulkCopy in .Net but the
>destination database has to be SQL Server 2005).
>
>Any help/ pointers would be appreciated.
>
>Thanks,
>Indian.
>

--
Breck Carter http://sqlanywhere.blogspot.com/

RisingRoad SQL Anywhere and MobiLink Professional Services
breck.carter@risingroad.com