set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: Test -- Create date: Test -- Description: Test -- ============================================= ALTER PROCEDURE [dbo].[delnp] -- Add the parameters for the stored procedure here @masa int = 0, AS BEGIN DECLARE @id int DECLARE @total int -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here SELECT @id = IDNotaDePlata FROM dbo.NoteDePlata WHERE Stare=2 AND IDmasa = @masa SELECT @total = Total FROM dbo.Incasari where IDNotaDePlata = @id PRINT @total END