Re: Stored procedure question

From: Narayana Vyas Kondreddi (answer_me_at_hotmail.com)
Date: 08/20/04


Date: Fri, 20 Aug 2004 11:30:45 +0100

I explained several ways for performing case sensitive searches here:
http://vyaskn.tripod.com/case_sensitive_search_in_sql_server.htm

-- 
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Aneesh" <aneesh.r@eostek.com> wrote in message
news:OVX2dlphEHA.632@TK2MSFTNGP12.phx.gbl...
You can use Convert function  if you really needs the case sensitive
comparison( in case u haven't configured you sql server)
"Narayana Vyas Kondreddi" <answer_me@hotmail.com> wrote in message
news:%23sUElynhEHA.1356@TK2MSFTNGP09.phx.gbl...
> Update Users
> SET Password = @NewPasssword
> where UserID = @UserID
> AND Password = @OldPassword
>
> The above will update only if both user id and password match with a row.
>
> You could capture the rowcount after this, using @@ROWCOUNT. Based on it
> being 0 or 1 you could return a status of your choice, using RETURN
> statement.
> -- 
> HTH,
> Vyas, MVP (SQL Server)
> http://vyaskn.tripod.com/
>
>
> "Nikolay Petrov" <johntup2@mail.bg> wrote in message
> news:%238Yk%23pnhEHA.3928@TK2MSFTNGP11.phx.gbl...
> I need to write a stored procedure which changes user password based on
> validity of his old password.
>
> My table with users contains this columns:
> UserID - int (unique)
> Username - nvarchar(20)
> Password - nvarchar(20)
>
> I can easy change the password by using:
> CREATE PROCEDURE dbo.ChangePassword
> @UserID
> @NewPassword
> @OldPassword
> AS
> Update .Users
> SET Password = @NewPasssword
> where UserID = @UserID
> But I want the procedure to check if the @OldPassword matches the one,
> stored in the table, and only then to change it.
> Also I want the procedure to return to my app a status if the chenge has
> occured or not.
>
> TIA
>
>
>


Relevant Pages

  • Re: so slow DDQ update statement...
    ... Vyas, MVP (SQL Server) ... SQL Server Articles and Code Samples @ http://vyaskn.tripod.com/ ... > Vyas, MVP ...
    (microsoft.public.sqlserver.dts)
  • Re: delete a system sp
    ... Vyas, MVP (SQL Server) ... >> how to rename or delete a stored procedure .. ...
    (microsoft.public.sqlserver.security)
  • Re: Question about check contraints
    ... that CHECK constraint is looking for. ... Vyas, MVP (SQL Server) ... > Vyas, MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: Lost Permissions after Detach/Attach
    ... Vyas, MVP ... > Did you move those databases to a different machine/different domain? ... > Vyas, MVP (SQL Server) ...
    (microsoft.public.sqlserver.server)
  • Re: Timing out????
    ... I didn't know the column name from tbDateDiff. ... Vyas, MVP ... and means something different to SQL Server. ... > DECLARE @IPResetCount BIGINT ...
    (microsoft.public.sqlserver.programming)

Loading