Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

RE: Different behavor with image and varbinary(max)?
Hi

It does look like you need to use CAST or Convert for the conversion between
varchar and varbinary (of any size) as detailed in
http://msdn2.microsoft.com/en-us/library/ms187928.aspx this has not changed
from SQL 2000.

John

"KM" wrote:

> Hello,
>
> I am having problem with the different behavior of image and varbinary(max
).
> I thought these two types are compatible, but seeing some different behavi
or.
> 
>
> Can someone tell me if this is expected behavior?
>
> 1. If I create table using "image" data type, I can insert string data int
o
> the table.
>
> create table kmimage(c1 image);
> insert into kmimage values ('<value> my blob c1 a </value>');
> select * from kmimage;
> c1
> ----
>  0x3C76616C75653E206D
 7920626C6F6220633120
 61203C2F76616C75653E

>
> 2. If I create table using varbinary(max), I cannot insert string data.
>
> create table kmvarbin(c1 varbinary(max));
> insert into kmvarbin values ('<value> my blob c1 a </value>');
> ==> Implicit conversion from data type varchar to varbinary(max) is not
> allowed. Use the CONVERT function to run this query.
>
> No problem using hexadecimal representation.
> insert into kmvarbin values
>  (0x3C76616C75653E206
 D7920626C6F622063312
 061203C2F76616C75653
E);
>
> select * from kmvarbin;
> c1
> ---
>  0x3C76616C75653E206D
 7920626C6F6220633120
 61203C2F76616C75653E

>
> Thank you very much for your help.
> KM
>

Report this thread to moderator Post Follow-up to this message
Old Post
John Bell
12-01-06 12:14 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 08:48 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006