Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gernating a key?

Status
Not open for further replies.

DOGWATCH

Programmer
Mar 11, 2004
120
US
I have unique company name for e.g.
company = "NEW YORK MED CTR" from that I would like
make a function to encode it into some kind of alpha numeric code that would be the equivalent.

I've considered maybe doing some kind of string to hex function, but haven't found much in terms of T-SQL solutions all all example ive found have been in java or .net
 
Do you want arbinary?, take a look at this
Code:
[COLOR=blue]select[/color] [COLOR=#FF00FF]convert[/color]([COLOR=blue]varbinary[/color](100),[COLOR=red]'NEW YORK MED CTR'[/color])
[COLOR=blue]select[/color] [COLOR=#FF00FF]convert[/color]([COLOR=blue]varchar[/color](100),0x4E455720594F524B204D454420435452)

Denis The SQL Menace
--------------------
SQL Server Code,Tips and Tricks, Performance Tuning
Google Interview Questions





 
Maybe a simple conversion to binary?

Code:
[COLOR=blue]Select[/color] [COLOR=#FF00FF]Convert[/color]([COLOR=blue]Binary[/color], [COLOR=red]'NEW YORK MED CTR'[/color])

[COLOR=blue]Select[/color] [COLOR=#FF00FF]Convert[/color]([COLOR=blue]VarChar[/color](1000), 0x4E455720594F524B204D4544204354520000000000000000000000000000)

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
ha ha ha. [lol]


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top