Re: Stored procedure question

From: Aneesh (aneesh.r_at_eostek.com)
Date: 08/19/04


Date: Thu, 19 Aug 2004 15:06:38 +0530

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: How to get list of EventClasses in MSSQLServer2000
    ... statement inside a stored procedure has completed.') ... SQL Server statement or stored procedure.') ... Plan','Displays the plan tree of the Transact-SQL statement executed.') ... Login','Occurs when a SQL Server login is added or removed; ...
    (microsoft.public.sqlserver.security)
  • Re: Can @@ROWCOUNT return NULL?
    ... from the stored procedure. ... > Immediately after each statement I save the value returned by @@ROWCOUNT to ... it appears that in SQL Server ... This is not the case here - the only DML queries are INSERTs into ...
    (comp.databases.ms-sqlserver)
  • Re: delete a system sp
    ... > Vyas, MVP (SQL Server) ... >> how to rename or delete a stored procedure .. ...
    (microsoft.public.sqlserver.security)
  • Re: Accessing FoxPro Free Table
    ... which the SQL Server service is running. ... account, ... > If you are creating a stored procedure and you want> to make sure that the procedure definition cannot be> viewed by other users, you can use the WITH ENCRYPTION> clause. ... The procedure definition is then stored in an> unreadable form. ...
    (microsoft.public.data.odbc)
  • Re: Adding date to parameter
    ... SqlClient provider which is specifically written for SQL Server. ... Hitchhiker's Guide to Visual Studio and SQL Server ... and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ... I made the assumption that the stored procedure went by the ...
    (microsoft.public.dotnet.framework.adonet)