Hi,I'm trying to use dynamic sql to create an insert script to provide to a client. Essentially I would like to provide a sql script to load some data into thier database. In the past, I have used dynamic sql to script out insert statements.Here is a very simple example:select 'insert into table (field1,field2) values (' + field1 + ',' + field2 + ')' from tableAnyway, one of the tables has a varbinary column. I'm running into problems converting it into a hexstring (or a readable text value).If I query the field I get a hexstring back.select vector ,convert(varchar(100), vector) As VectorVar ,convert(nvarchar(100), vector) As VectorNVarfrom tableVector-----------------------------------0x8204F9E6E062BCE08DFE0A4E045BDC0EVectorVar-----------------------------------fÕiÚHf“š©Î©0 VectorNVar-----------------------------------????????
I can't just add the vector field to my dynamic sql because I get this error."Invalid operator for data type. Operator equals add, type equals varchar."So I need to convert it into a string first (varchar,nvarchar??) but when I do the value gets messed up. Does anyone know how to return the actual0x8204F9E6E062BCE08DFE0A4E045BDC0E value in a string format?Thanks,NicNic