Encryption Example

,

Here in this T-sql tip I'am trying to compare the word "Hijacker" with two cases(line 3 and 4). Now they are in same when you compare the case (letter to letter), now you change the case of word "Hijacker" in either of the lines and run this SQL statements it will return different results. This kind of comparision can be used in case if your server is set for case insensitiveness. And also this kind of statements can be used to encrypt the password for client server applications etc..I have line number for the convience of explanation

1: 	DECLARE @gg VARCHAR(100)
2: 	DECLARE @AA VARCHAR(100)
3: 	select @gg = ( select encrypt('Hijacker') )
4: 	select @AA = ( select encrypt('Hijacker') )
5	if @gg=@AA 
6		print @gg+" ---- They are Same -------"+@AA
7	if @gg<>@AA
8		print @gg+" ---- Not Matching  -------"+@AA

Rate

Share

Share

Rate