Print Page | Close Window

Stored Procedure problem

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=8420
Printed Date: 28 March 2026 at 11:23pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Stored Procedure problem
Posted By: Mart
Subject: Stored Procedure problem
Date Posted: 30 December 2003 at 5:59am

Hi guys, Im having trouble with this stored procedure. I basically only want to update the users password if it has been filled in. Can anyone see the problem (its probably dead simple), at the minute it doesnt change the password.

CREATE PROCEDURE [dbo].[nws_sp_EditUser](

@ID int,

@username VarChar(100),

@password VarChar(100)='#notsupp#',

@role VarChar(50)

) AS

IF @password='#notsupp#'

BEGIN

UPDATE [nws_mc_Users] SET [username]=@username, [password]=pwdencrypt(@password), [role]=@role WHERE [ID]=@ID

END

ELSE

BEGIN

UPDATE [nws_mc_Users] SET [username]=@username, [role]=@role WHERE [ID]=@ID

END

GO

Any help is apreaciated.




Replies:
Posted By: michael
Date Posted: 30 December 2003 at 11:26pm

Does work like this:

CREATE PROCEDURE [dbo].[nws_sp_EditUser](
@ID int,
@username VarChar(100),
@password VarChar(100)= NULL,
@role VarChar(50)
) AS
If NOT @Password IS NULL
Begin
etc.



-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net