Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ravininave
Posting Yak Master
111 Posts |
Posted - 2009-10-04 : 06:04:25
|
| Actually My Web Application updates from Client Server Application. So Password field get reset everyday. User Can't change their Password. For that I've created one more Table to store Password. Whenever User enter Password I check it into new Password table. If his ID found then check for Password. If ID Not found then check UserName and Password in Original Table. My Table StructureTable : AppMainCode,CustName,PassTable:PassTblCode,PassI've written a stored Procedure like :CREATE PROCEDURE [dbo].[FindUser] (@Code_1 [numeric](9),@Pass_2 [nvarchar](50))AS if exists(select Code from PassTbl Where Code =@Code_1 ) begin if exists (select Code from PassTbl Where Code =@Code_1 and Pass=@Pass_2) begin Select CustName from AppMain Where Code =@Code_1 ORDER BY code end endelse begin select CustName from AppMain Where Code=@Code_1 and Pass=@Pass_2 order by CodeendIt works fine, but it TAKES TIME to execute. Can we simplify it so that it would response soon. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-05 : 13:56:22
|
seems like what you need is thisCREATE PROCEDURE [dbo].[FindUser] (@Code_1 [numeric](9)=null,@Pass_2 [nvarchar](50))=nullAS select CustName from AppMain Where (Code=@Code_1 or @Code_1 is null)and (Pass=@Pass_2 or @Pass_2 is null)GO |
 |
|
|
ravininave
Posting Yak Master
111 Posts |
Posted - 2009-10-06 : 06:51:53
|
| No, you are not geting my problem. Actually Complete data is alredy in AppMast Table which updates from offline software. Already there is a password and id field. If user will change his password online then it will overwrite on next offline update. for that I've created a passtbl. I've to find if entered id exists in passtbl, if exists check password, if found find name from appmast. The logic is as follows.Check ID in PassTblif found thenfind entered password is correctif correct thenfind name from appmastendifelsefind name from appmast where id=entered id and password =entered passwordendif |
 |
|
|
|
|
|