Click here to Skip to main content
15,887,364 members
Home / Discussions / Database
   

Database

 
AnswerRe: Select top 2 not working on Maximum Record using SQL Pin
Eddy Vluggen29-May-13 3:17
professionalEddy Vluggen29-May-13 3:17 
AnswerRe: Select top 2 not working on Maximum Record using SQL Pin
Arman S.29-May-13 9:44
Arman S.29-May-13 9:44 
Questiondecryption Pin
Member 870181328-May-13 6:42
Member 870181328-May-13 6:42 
AnswerRe: decryption Pin
R. Giskard Reventlov28-May-13 7:43
R. Giskard Reventlov28-May-13 7:43 
QuestionRe: decryption Pin
Eddy Vluggen28-May-13 9:45
professionalEddy Vluggen28-May-13 9:45 
AnswerRe: decryption Pin
Member 870181330-May-13 16:37
Member 870181330-May-13 16:37 
GeneralRe: decryption Pin
Eddy Vluggen31-May-13 6:23
professionalEddy Vluggen31-May-13 6:23 
AnswerRe: decryption Pin
poongunrans28-May-13 20:21
poongunrans28-May-13 20:21 
Encryption / Decryption


set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fn_Cryptography]
(
@String varchar(50)
)
/*
Author: POONGUNRAN S
Create date: 29-May-2013
Description: Encrypt / Decrypt
Parameters : @String - String to be encrypted / decrypted
*/
RETURNS varchar(50)
AS
BEGIN
IF @String = ''
RETURN ''

SELECT @String = LTRIM(RTRIM(@String))

DECLARE @Key varchar(50), @Crypt varchar(50), @Len smallint, @n smallint

SELECT @n = 235
SELECT @Key = ''
WHILE @n <= 255
BEGIN
SELECT @Key = @Key + CHAR(@n)
SELECT @n = @n + 1
END

SELECT @Crypt = ''
SELECT @Len = LEN(@String)
SELECT @n = 1

WHILE @n <= @Len
BEGIN
SELECT @Crypt = @Crypt + CHAR(ASCII(SUBSTRING(@String,@n,1)) ^ ASCII(SUBSTRING(@Key,@n,1)))
SELECT @n = @n + 1
END

RETURN @Crypt
END



Input put:

Select dbo.fn_Cryptography('test')

o/p : Ÿ‰žš


select dbo.fn_Cryptography('Ÿ‰žš')

o/p : test
QuestionSQL Pin
Shiv irfi26-May-13 21:11
Shiv irfi26-May-13 21:11 
AnswerRe: SQL Pin
Mycroft Holmes26-May-13 21:52
professionalMycroft Holmes26-May-13 21:52 
JokeRe: SQL Pin
Killzone DeathMan28-May-13 5:35
Killzone DeathMan28-May-13 5:35 
AnswerRe: SQL Pin
Eddy Vluggen28-May-13 9:59
professionalEddy Vluggen28-May-13 9:59 
AnswerRe: SQL Pin
Azarudhin4-Jun-13 3:45
professionalAzarudhin4-Jun-13 3:45 
AnswerRe: SQL Pin
prakash.chakrala5-Jul-13 1:09
prakash.chakrala5-Jul-13 1:09 
QuestionSelect first entries in a table matching given criteria Pin
Dewald26-May-13 10:12
Dewald26-May-13 10:12 
AnswerRe: Select first entries in a table matching given criteria Pin
Mycroft Holmes26-May-13 12:47
professionalMycroft Holmes26-May-13 12:47 
GeneralRe: Select first entries in a table matching given criteria Pin
Dewald26-May-13 22:10
Dewald26-May-13 22:10 
GeneralRe: Select first entries in a table matching given criteria Pin
Mycroft Holmes26-May-13 22:35
professionalMycroft Holmes26-May-13 22:35 
GeneralRe: Select first entries in a table matching given criteria Pin
Dewald26-May-13 22:56
Dewald26-May-13 22:56 
GeneralRe: Select first entries in a table matching given criteria Pin
Mycroft Holmes26-May-13 23:04
professionalMycroft Holmes26-May-13 23:04 
GeneralRe: Select first entries in a table matching given criteria Pin
Jörgen Andersson27-May-13 0:32
professionalJörgen Andersson27-May-13 0:32 
GeneralRe: Select first entries in a table matching given criteria Pin
Dewald27-May-13 0:54
Dewald27-May-13 0:54 
GeneralRe: Select first entries in a table matching given criteria Pin
Jörgen Andersson27-May-13 11:12
professionalJörgen Andersson27-May-13 11:12 
QuestionWindows accounts for SSE Pin
Richard.Berry10025-May-13 22:35
Richard.Berry10025-May-13 22:35 
QuestionVA Database Pin
Daaron24-May-13 4:10
Daaron24-May-13 4:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.