Solved

how do i convert binary values obtained from sql server 2005 to varchar and display in ms access 2007 queries

Posted on 2008-10-16
8
672 Views
Last Modified: 2010-04-21
i am trying to create a query in ms access where in i am obtaining a binary value from sql server 2005. i am not able to display the same in ms access 2007. it is showing some junk values. i actually want to convert this to varchar so that i can link that field to another varchar field in the tables to display the values. please help me out. i am trying to create a custom function in ms access which convert binary to varchar so that i can use that varchar in queries
0
Comment
Question by:karthik_kota
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 9

Expert Comment

by:Sander Stad
ID: 22730668
There is a function in MS SQL Server 2005 that converts it for you. This is the function: fn_varbintohexstr
Look at this for more information: http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/Q_20289438.html
0
 
LVL 9

Expert Comment

by:Sander Stad
ID: 22730677
In conjunction with the method you could use a linked server to the access database to get the data from the MS SQL server to the table in MS Access
0
 

Author Comment

by:karthik_kota
ID: 22730842
yes i do know about the function fn_varbintohexstr. also there is dbo.hex function. but i dont want to make any changes in sql 2005. i am actually looking for a custom function(vb script) in ms access which converts binary to varchar and displays the binary value properly(instead of using junk values) when used in ms access queries and should be able to link that field to another varchar field to obtain values
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:karthik_kota
ID: 22730930
the binary data is like this "0x174795BED6B1B141B55628E500FC50FC". this is of binary datatype. i want to convert this to varchar format by creating a custom function in ms access. please help me out. i dont want to make any changes in sql
0
 

Author Comment

by:karthik_kota
ID: 22730937
is there any function in ms access which does that.
0
 

Author Comment

by:karthik_kota
ID: 22737827
ok i will make it simple. i have dbo.contact. persid(varchar) and dbo.chg. uuid(binary). both are from different tables. i have imported these tables from sql server 2005. now i want to link these two fields in ms access 2007 query ( when contact.persid = chg.uuid) and get the results displayed. but since both are of different datatypes. i am not able to get the results from querry. please help me out in having a custom function to convert binary to varchar. ultimately i want to see the results from the querry overcoming the problem in datatype
0
 
LVL 2

Accepted Solution

by:
jchevali earned 500 total points
ID: 23166280
There is a way:

Navigate to this address and borrow the TSToHex() function:
http://kbalertz.com/170380/TimeStamp-Value-Server.aspx

Change the function parameter to be a String instead of a rdocolumn.
Change the For command in TSToHex() to read like this:
For b = 1 To LenB(sBinRep)

In Access, add the function to a public code module.
Add a linked table to the SQL table containing your binary(16) field.
Add a new Access query, switch to SQL view, and enter the following:
SELECT TSToHex(LeftB(uuid,16)) FROM dbo_chg;
Switch to data view.

The contents of the binary field should now be displayed as a hex string.
0
 

Author Closing Comment

by:karthik_kota
ID: 31506702
perfect sollution
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question