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
vutharadi prathyusha
NA
18
26.5k
Insert and Update
Sep 23 2015 5:15 AM
Hi,
Iam writing the stored procedure ,I want to insert and update the values for the one table in one qurey .I want to insert team name if teamid is not specified, if teamid is specified then i will update the teamname based on id.But the problem is i didn't get any issues i will executed successfully.
issue is i'm getting the insert value but the value is not updated .
Here is my query..
ALTER PROCEDURE UspInsertUpdateTeam
(
@TeamID INT,
@TeamName NVARCHAR(50)
)
AS
BEGIN
SET NOCOUNT ON;
--IF EXISTS (SELECT TeamName FROM Team )
--IF EXISTS (SELECT TeamName=NULL FROM Team)
IF @TeamName=''
insert into Team(TeamName)values(@TeamName);
ELSE IF @TeamName='TeamName'
UPDATE Team set TeamName=@TeamName
where TeamID=@TeamID;
END
If anyone please help me.
Thanks,
Prathysha
Reply
Answers (
8
)
how can i execute query with more than 4000 character
Query in Sql Server