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.
| Author |
Topic |
|
aakcse
Aged Yak Warrior
570 Posts |
Posted - 2009-10-05 : 09:54:14
|
| I would like to generate md hash value for a set of columns in sqlserver 2005 say if i have a columns names a b cI want to concat them ( a,b,c) and generate hash value for all threein a single column.Regards,cse. |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2009-10-05 : 13:18:10
|
| If you're using SQL Server 2005 or higher, you can write a CLR function that uses the built-in .Net Cryptography library, which has MD5 and other hashing functions. Or, if you just need a checksum of some kind, SQL Server has CHECKSUM and BINARY_CHECKSUM functions built-in. Books Online has more details. |
 |
|
|
aakcse
Aged Yak Warrior
570 Posts |
Posted - 2009-10-05 : 13:24:06
|
| Thanks all,I used the below query..select count(*), hashbytes('MD5',ltrim(rtrim(isnull(AutrName,'')))+ ltrim(rtrim(isnull(To,'')))+ ltrim(rtrim(isnull(CC,'')))+ ltrim(rtrim(isnull(BCC,'')))+ ltrim(rtrim(isnull(Subt,''))))FROM Datquery |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2009-10-05 : 13:25:05
|
| Depending on what you want to do there a couple of built in functions that may or may not meet you needs: HASHBYTES(), CHECKSUM() and BINARY_CHECKSUM().EDIT: Dang, late to the party. That's what I get for starting a reply and then heading off to a meeting.. :) |
 |
|
|
|
|
|
|
|