lw_changeLocation.sql
If Exists (Select * From sysobjects Where name = N'lw_changeLocation' And user_name(uid) = N'dbo')
Drop Procedure dbo.lw_changeLocation
Go
CREATE Procedure lw_changeLocation(
@locationId int,
@name nvarchar(50),
@street nvarchar(60),
@city nvarchar(15),
@region nvarchar(15),
@postalCode nvarchar(10),
@country nvarchar(15),
@phone nvarchar(24),
@email nvarchar(50),
@maxOccupancy tinyint,
@comment ntext
)
As
set nocount on
if exists(select * from location where locationId = @locationId)
begin
update location set [name]= @name,street = @street,city = @city,
region = @region,postalCode = @postalCode,country = @country,
phone = @phone,email = @email,maxOccupancy = @maxOccupancy,
comment = @comment
where locationId = @locationId
return 0
end
else
begin
raiserror('Location does not exist',-1,-1) with nowait
return 1
end
Go