Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databasesHi 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 >
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread