First I check if the ABBR exists, then I update it. It seems like I am making 2 requests - 99% of the time I would never send the wrong parameters so it's just a check.
I was wondering if there was a way to ask AND update in one step?
[code]
ALTER PROCEDURE [dbo].[League_GetTeamA bbr]
(@LeagueID int, @TeamName nvarchar(50), @Abbr nvarchar(10) OUTPUT)
As
IF Exists(SELECT ABBR from League_TeamData WHERE TeamName = @TeamName AND LeagueID = @LeagueID)
BEGIN
SET @Abbr = (SELECT ABBR from League_TeamData WHERE TeamName = @TeamName AND LeagueID = @LeagueID)
RETURN 1
End
ELSE
RETURN 0
[code]
I was wondering if there was a way to ask AND update in one step?
[code]
ALTER PROCEDURE [dbo].[League_GetTeamA bbr]
(@LeagueID int, @TeamName nvarchar(50), @Abbr nvarchar(10) OUTPUT)
As
IF Exists(SELECT ABBR from League_TeamData WHERE TeamName = @TeamName AND LeagueID = @LeagueID)
BEGIN
SET @Abbr = (SELECT ABBR from League_TeamData WHERE TeamName = @TeamName AND LeagueID = @LeagueID)
RETURN 1
End
ELSE
RETURN 0
[code]
Comment