TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
anil john
NA
156
210.4k
stored procedure
Aug 31 2012 7:58 AM
i have written a sp for cheching the existance of a user,is this code right / wrong but i got wrong results
my sp:
ALTER PROCEDURE dbo.sp_UserDetailsInsertUpdate
(
@iUid int,
@vUserName varchar(50),
@vUserId varchar(50),
@vPassword varchar(50),
@iUserLevel int,
@blockType int
)
AS
SET NOCOUNT ON
If(@blockType=0)
Begin
IF EXISTS(SELECT vUserId,iUserLevel FROM tblUserDetails WHERE vUserName=@vUserName AND iUserLevel=@iUserLevel)
RETURN
ELSE
INSERT INTO tblUserDetails(vUserName,vUserId,vPassword,iUserLevel)VALUES(@vUserName,@vUserId,@vPassword,@iUserLevel)
select @@identity as RowID
End
ELSE IF(@blockType=1)
Begin
UPDATE tblUserDetails SET vUserName=@vUserName,
vUserId=@vUserId,vPassword=@vPassword,
iUserLevel=@iUserLevel WHERE iUid=@iUid
SELECT @iUid As RowID
End
RETURN
Reply
Answers (
1
)
what is diffrence between SQL and |ORACLE ?
Create SSIS package for backup database and restore in sql server 2008 R2?