BDG Scenario 3

lw_addLocation.sql

If Exists (Select * From sysobjects Where name = N'lw_addLocation' And user_name(uid) = N'dbo')
    Drop Procedure dbo.lw_addLocation
Go

CREATE Procedure lw_addLocation(
  @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,
  @locationId int OUTPUT
 )
As
 set nocount on 
 
 insert into location values(@name,@street,@city,@region,@postalCode,
                        @country,@phone,@email,@maxOccupancy,@comment)
   
   select @locationId = @@IDENTITY                        
   
   return @@ERROR

Go