How to convert a string value to a binary in SQL Server and data objects?
search cancel

How to convert a string value to a binary in SQL Server and data objects?

book

Article ID: 252218

calendar_today

Updated On:

Products

CA Service Catalog

Issue/Introduction

Service Catalog does not allow binary variables so we need to find a way to convert a string value to binary to search ids in mdb database (ie: group_id, contact_uuid, etc)

Environment

Release : 17.x

Resolution

To convert a string value to binary (ie: group_id, contact_uuid) the following needs to be used in the data object:

CONVERT(VARBINARY(25), %SelCat%, 1)

Where %SelCat% is a String variable (ie: 0x22DB420314BFFD49926433E28FFB84F8)

Example:

SELECT 
sym, group_id from chgcat
where del = '0' and sym like 'Test%' and group_id = CONVERT(VARBINARY(25), %SelCat%, 1);

Additional Information