I am trying to insert a HEX representation of XML (I get HEX string of xml file) into a Image column.
I tried this:
if exists (select [Version] from [...].[dbo].[Table] where Version ='1.1.1.1') update [.....].[dbo].[Table] set [Xsd] = 0xEFBBBF3C3F7857465466.... else insert into [....].[dbo].[Table] ([Version], [Xsd]) values ('1.1.1.1',0xEFBBBF3C3F7857465466....) go But, when I execute this query, I get first zero:
0x0EFBBBF3C3F7857465466.... - Image field, can NULL. How to fix it? I try to make replace try to make replace:
Select replace(rtrim(replace('0x0EFBBBF3C3F7857465466....','0',' ')),' ','0'); But get decimal-version: 307854...
And length is 217847 (I count from 0).
Another strings inserts without zero!
It seems that it is alignment at SQL Server: when I add 'E' symbol at the end of string- it makes a valid begin of string: 0xEFBB....
EDIT: i remove quotes ,but it does not works.
ntext,text, andimagedata types will be removed in a future version of SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Usenvarchar(max),varchar(max), andvarbinary(max)instead. See details here0on the front for the extra four bits it had to store.