Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Convert VarBinary to HexString SQL2000

Author  Topic 

mattster2020
Starting Member

6 Posts

Posted - 2012-01-11 : 11:49:53
Afternoon All,

I'm using the function below in SQL2008 to convert a binary to hex

master.sys.fn_varbintohexstr(@Supp_Attach_id)

Our production enviroment uses SQL2000, does anyone know of a function or code that can do the same?

Regards,

Matt

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-01-11 : 12:09:29
I don't have SQL 2000 (and not very familiar with it), but googling for it brought up this page: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61914

Looks like you should be able to use the extended stored proc master..xp_varbintohexstr
Go to Top of Page

mattster2020
Starting Member

6 Posts

Posted - 2012-01-11 : 13:16:17
Thanks Sunitabeck,

I have compiled the following code:

Declare @Supp_Attach_id binary(8), @Supp_Attach_Name varchar(300), @hexstr varchar(300), @cmd varchar(1000)
set @Supp_Attach_id = 0x00000000000000B8
set @Supp_Attach_Name = 'email3.txt'
set @hexstr = ''
exec master.dbo.xp_varbintohexstr @Supp_Attach_id, @hexstr output
print @hexstr

--SET @CMD = '\\Poland\Filepath\Email_Attach_Temp\App\Save_Attachments' + ' ' + master.sys.fn_varbintohexstr(@Supp_Attach_id) + ' ' + @Supp_Attach_Name
SET @CMD = '\\Poland\Filepath\Email_Attach_Temp\App\Save_Attachments.exe' + ' ' + (@hexstr) + ' ' + @Supp_Attach_Name

Print @cmd

EXEC master..xp_CMDShell @CMD

Doesnt seem to be converting the binary to hex correctly though?
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-01-11 : 14:39:02
Unfortunately, I don't have SQL 2000 to test this or see its behavior (I know so little about SQL 2000 in any case).

Hopefully someone else who has more familiarity with SQL 2000 will respond.
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2012-01-11 : 17:23:18
I wrote a post about this ages ago, I'll try and find it

Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2012-01-11 : 19:02:38
This is what I was thinking of : http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=138869

Not sure if it's helpful though....

Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -