SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Convert VarBinary to HexString SQL2000
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mattster2020
Starting Member

6 Posts

Posted - 01/11/2012 :  11:49:53  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 01/11/2012 :  12:09:29  Show Profile  Reply with Quote
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 - 01/11/2012 :  13:16:17  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 01/11/2012 :  14:39:02  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

United Kingdom
3451 Posts

Posted - 01/11/2012 :  17:23:18  Show Profile  Visit Transact Charlie's Homepage  Reply with Quote
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
Flowing Fount of Yak Knowledge

United Kingdom
3451 Posts

Posted - 01/11/2012 :  19:02:38  Show Profile  Visit Transact Charlie's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000