Showing posts with label inserted. Show all posts
Showing posts with label inserted. Show all posts

Thursday, March 29, 2012

finding hidden chars in sql query


I am working on a login system in flex and asp. I am encrypting the password before it is inserted it into the SQL database. But then when i do SELECT statement with username and encrypted password it returns 0 users found.
I outputted the sql statement and they passwords look excatly the same. But the SQL Select count(*) returns a 0.

link to the encrypting is used:
http://www.4guysfromrolla.com/webtech/110599-1.2.shtml

other information:
script language: asp + flex
database: sql server 2005

So i am thinking that their are hidden chars in the password. Is their a way to check this or even convert/exclude them ?
Any links or tips would be very helpfull

Use the sample to solve your issue...

Alter Function dbo.En_De_Crypt(@.Input varchar(max), @.Key int ) Returns Varchar(Max) as

Begin

Declare @.Len as Int;

Declare @.I as Int;

Declare @.Output as Varchar(max)

Select @.Len = Len(@.Input), @.I =1, @.Output=''

Declare @.Number Table (N int);

While(@.I<=@.Len)

Begin

Insert into @.Number Values(@.I);

Set @.I = @.I + 1;

End

Select @.Output = @.Output + Char(Ascii(Substring(@.Input,N,1)) ^ @.Key)

From @.Number

return @.Output

End

Go

Create Table #Passwords(

Password varchar(20)

);

Insert Into #Passwords Values(dbo.En_De_Crypt('One1234$$',100));

Insert Into #Passwords Values(dbo.En_De_Crypt('M1cr0$0ft',100));

Insert Into #Passwords Values(dbo.En_De_Crypt('Or@.c1e',100));

Insert Into #Passwords Values(dbo.En_De_Crypt('@.pp1e',100));

Select dbo.En_De_Crypt(Password,100) ,Password From #Passwords

/*

Orginal value Decrypted Value

One1234$$ + _VWP@.@.

M1cr0$0ft )Up'16T@.T '10

Or@.c1e +_$p_par

@.pp1e $__U_par */

--None of the query will return the data here..

Select Count(*) From #Passwords Where Password = '+

_VWP@.@.'

Select Count(*) From #Passwords Where Password = ')Up'16T@.T '10'

Select Count(*) From #Passwords Where Password = '?_p$'

Select Count(*) From #Passwords Where Password = '$__U_par'

--Use the following query to get the result..

Select Count(*) From #Passwords Where dbo.En_De_Crypt(Password,100)='M1cr0$0ft'

|||thnx Manivannan for the reply.
i will try it out.

Friday, March 9, 2012

find out how often is a table get updated/inserted

How can I find out how often is a table get updated/inserted?
I'm planning to use sql profiler or maybe performance monitor, but I'm not
sure how to do that. I don't know what criteria should be set to catch them.
I know I can do a trigger and log to a log table. but I wondered if there
is alternative way, use either sql profiler or performance monitor.
You can use profiler, capture the data to a file or table...
The event should be SQL Statement Ending. Then capture whatever counters
you wish...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Kenny" <pearl_77@.hotmail.com> wrote in message
news:%23KZroFBcEHA.2812@.TK2MSFTNGP11.phx.gbl...
> How can I find out how often is a table get updated/inserted?
> I'm planning to use sql profiler or maybe performance monitor, but I'm not
> sure how to do that. I don't know what criteria should be set to catch
them.
> I know I can do a trigger and log to a log table. but I wondered if there
> is alternative way, use either sql profiler or performance monitor.
>

find out how often is a table get updated/inserted

How can I find out how often is a table get updated/inserted?
I'm planning to use sql profiler or maybe performance monitor, but I'm not
sure how to do that. I don't know what criteria should be set to catch them.
I know I can do a trigger and log to a log table. but I wondered if there
is alternative way, use either sql profiler or performance monitor.You can use profiler, capture the data to a file or table...
The event should be SQL Statement Ending. Then capture whatever counters
you wish...
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Kenny" <pearl_77@.hotmail.com> wrote in message
news:%23KZroFBcEHA.2812@.TK2MSFTNGP11.phx.gbl...
> How can I find out how often is a table get updated/inserted?
> I'm planning to use sql profiler or maybe performance monitor, but I'm not
> sure how to do that. I don't know what criteria should be set to catch
them.
> I know I can do a trigger and log to a log table. but I wondered if there
> is alternative way, use either sql profiler or performance monitor.
>

find out how often is a table get updated/inserted

How can I find out how often is a table get updated/inserted?
I'm planning to use sql profiler or maybe performance monitor, but I'm not
sure how to do that. I don't know what criteria should be set to catch them.
I know I can do a trigger and log to a log table. but I wondered if there
is alternative way, use either sql profiler or performance monitor.You can use profiler, capture the data to a file or table...
The event should be SQL Statement Ending. Then capture whatever counters
you wish...
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Kenny" <pearl_77@.hotmail.com> wrote in message
news:%23KZroFBcEHA.2812@.TK2MSFTNGP11.phx.gbl...
> How can I find out how often is a table get updated/inserted?
> I'm planning to use sql profiler or maybe performance monitor, but I'm not
> sure how to do that. I don't know what criteria should be set to catch
them.
> I know I can do a trigger and log to a log table. but I wondered if there
> is alternative way, use either sql profiler or performance monitor.
>

Friday, February 24, 2012

Find a newly inserted record from table without using MAX or TOP

i have a table employee and i want to find the newly inserted record from employee table without using MAX And TOP ...it possible ? yes then How?

Quote:

Originally Posted by Ripendra007

i have a table employee and i want to find the newly inserted record from employee table without using MAX And TOP ...it possible ? yes then How?


i'm assuming you're using an identity column as the primary key on your table. if so you can say:
SELECT @.@.IDENTITY

your development environment might also provide this information in a more seamless way