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.

How do I retrieve a column's data (BLOB) and write it to local file system

3 posts in General Discussion Last posting was on 2010-10-09 11:29:51.0Z
Jeff Posted on 2010-10-08 19:56:49.0Z
Sender: 6c95.4caf7666.1804289383@sybase.com
From: Jeff
Newsgroups: sybase.public.ase.general
Subject: How do I retrieve a column's data (BLOB) and write it to local file system
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4caf7781.6cbb.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 8 Oct 2010 12:56:49 -0700
X-Trace: forums-1-dub 1286567809 10.22.241.41 (8 Oct 2010 12:56:49 -0700)
X-Original-Trace: 8 Oct 2010 12:56:49 -0700, 10.22.241.41
Lines: 13
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29633
Article PK: 78863

Hello,

I know how to create the table, I have inserted a text
image, it replicates, etc. My question is, how do I retrieve
the column's data and write it to a local file system?

psuedocode
extract dog_tag_template from template @C:\temp\template.jpg
or
fetch dog_tag_template from template @C:\temp\template.jpg

Thank you,
Jeff


"Mark A. Parsons" <iron_horse Posted on 2010-10-08 20:42:46.0Z
From: "Mark A. Parsons" <iron_horse@no_spamola.compuserve.com>
User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
Subject: Re: How do I retrieve a column's data (BLOB) and write it to local file system
References: <4caf7781.6cbb.1681692777@sybase.com>
In-Reply-To: <4caf7781.6cbb.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4caf8246$1@forums-1-dub>
Date: 8 Oct 2010 13:42:46 -0700
X-Trace: forums-1-dub 1286570566 10.22.241.152 (8 Oct 2010 13:42:46 -0700)
X-Original-Trace: 8 Oct 2010 13:42:46 -0700, vip152.sybase.com
Lines: 26
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29636
Article PK: 78865

isql and bcp are my favorite tools. (with isql you may need to do some editing of the output)

I'm sure there are plenty of ways to do it with perl, java and c (though I don't personally use these).

Are you looking to pull the text value for a single row, and if so, what column(s) make up the the PK?

Are you looking to pull multiple rows, and if so, are you looking to put them all in one file or split them out into
separate files?

Do you need to stored anything else in the file besides the contents of the text column, and if so, what's the format of
the file?

Jeff wrote:
> Hello,
>
> I know how to create the table, I have inserted a text
> image, it replicates, etc. My question is, how do I retrieve
> the column's data and write it to a local file system?
>
> psuedocode
> extract dog_tag_template from template @C:\temp\template.jpg
> or
> fetch dog_tag_template from template @C:\temp\template.jpg
>
> Thank you,
> Jeff


Rob V [ Sybase ] Posted on 2010-10-09 11:29:51.0Z
From: "Rob V [ Sybase ]" <robv@DO.NOT.SPAM.sypron.nl.REMOVE.THIS.DECOY>
Reply-To: robv@DO.NOT.SPAM.sypron.nl.REMOVE.THIS.DECOY
Organization: Sypron BV / TeamSybase / Sybase
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
Subject: Re: How do I retrieve a column's data (BLOB) and write it to local file system
References: <4caf7781.6cbb.1681692777@sybase.com>
In-Reply-To: <4caf7781.6cbb.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4cb0522f$1@forums-1-dub>
Date: 9 Oct 2010 04:29:51 -0700
X-Trace: forums-1-dub 1286623791 10.22.241.152 (9 Oct 2010 04:29:51 -0700)
X-Original-Trace: 9 Oct 2010 04:29:51 -0700, vip152.sybase.com
Lines: 62
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29640
Article PK: 78869


On 08-Oct-2010 21:56, Jeff wrote:
> Hello,
>
> I know how to create the table, I have inserted a text
> image, it replicates, etc. My question is, how do I retrieve
> the column's data and write it to a local file system?
>
> psuedocode
> extract dog_tag_template from template @C:\temp\template.jpg
> or
> fetch dog_tag_template from template @C:\temp\template.jpg
>
> Thank you,
> Jeff

If you don't want to write any CT-lib programs yourself (and I guess you
don't), there are two other possibilities:

- google for "bin2sql halford" to pick up Bret Halford's bin2sql and
sql2bin C-programs. These are very small programs you must compile and
link yourself and then you can use them to copy image data to and from
local files.

- use a BCP format file. This doesn't require compiling any code but
needs soem additional scripting around it.
The format file would look like this (3 lines):

10.0
1
1 SYBIMAGE 0 <size-in-bytes> "" 1 ImgColumnName

Now, you can run BCP in or out with this format file:

bcp mydb..mytable in your_local_file -U... -P... -S... -f
your_format_file -Tsize-in-bytes

Note that ImgColumnName must be the only column in table mytable (for
importing at least).

A ready-to-use shell script which handles all technical matters around
the format file and import/export is available as part of section 14.4.
in my book "Tips, Tricks & Recipes for Sybase ASE" (www.sypron.nl/ttr).

HTH,

Rob V.
-----------------------------------------------------------------
Rob Verschoor

Certified Sybase Professional DBA for ASE 15.0/12.5/12.0/11.5/11.0
and Replication Server 15.0.1/12.5 // TeamSybase

Author of Sybase books (order online at www.sypron.nl/shop):
"Tips, Tricks & Recipes for Sybase ASE" (ASE 15 edition)
"The Complete Sybase ASE Quick Reference Guide"
"The Complete Sybase Replication Server Quick Reference Guide"

mailto:rob@YOUR.SPAM.sypron.nl.NOT.FOR.ME
http://www.sypron.nl
Sypron B.V., Amersfoort, The Netherlands
Chamber of Commerce 27138666
-----------------------------------------------------------------