Re: Copying Binary data from one table to another
- From: normanp <normanp@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 6 Mar 2008 04:38:02 -0800
Debug what? Heres the testing thing i've broken it down to.
The original table
[code]
CREATE TABLE `binary_a` (
`org_a` tinyblob NOT NULL,
`org_b` blob NOT NULL,
`org_c` tinyint(1) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
[/code]
The one i'm trying to copy to
[code]
CREATE TABLE `binary_b` (
`copy_a` tinyblob NOT NULL,
`copy_b` blob NOT NULL,
`copy_c` tinyint(1) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
[/code]
The Sql to create the binary stuff:
[code]
insert into binary_a (org_a,org_b,org_c) values
(aes_encrypt('norman','mongo'),aes_encrypt('mink','mongo'),1)
[/code]
The ASP:
[code]
set original = Cecexe.execute("select org_a,org_b,org_c from binary_a")
if original.eof and original.bof then
Response.Write("Did not find data to print")
else
do while not original.eof
'Response.Write original("org_a")&" "&original("org_b")&" "&original("org_c")
CecExe.Execute("insert into binary_b (copy_a,copy_b,copy_c) values
('"&original("org_a")&"', '"&original("org_b")&"', "&original("org_c")&") ")
original.MoveNext
loop
End If
[/code]
"Evertjan." wrote:
=?Utf-8?B?bm9ybWFucA==?= wrote on 06 mrt 2008 in.
microsoft.public.inetserver.asp.db:
"Bob Barrows [MVP]" wrote:
normanp wrote:
Hi,
I have these tables with binary data stored in tinyblobs and blobs
in MySql. In my application I sometimes need to copy them to
another table. Not all the data, maybe just a column or two. So I
first select the data into a record set and then loop and insert it
(its the only way can do it)
I've never worked with mysql, but this statement would make me
absolutely reject it as a database-of-choice if I was ever
considering it. Are you sure this is the only way? Can't you do a
simple "INSERT INTO tablename (<column list>) SELECT <column list>
FROM othertable" in MySQL?
[Please do not toppost on usenet]
Thanks. Unfortunately there is no other way for me to do this. I have
to select then insert. Because sometimes i may need a few columns and
sometime others. Its hard for me to put it in words. But I think
you'll understand.
By why will binary stuff not work?
However:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch
seems to suggest, the error is not database related, but vbs code.
Start debugging!
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
- References:
- Re: Copying Binary data from one table to another
- From: Bob Barrows [MVP]
- Re: Copying Binary data from one table to another
- From: Evertjan.
- Re: Copying Binary data from one table to another
- Prev by Date: Re: Copying Binary data from one table to another
- Next by Date: Re: Copying Binary data from one table to another
- Previous by thread: Re: Copying Binary data from one table to another
- Next by thread: Re: Copying Binary data from one table to another
- Index(es):
Relevant Pages
|
Loading