Добавил:
rushevamar@mail.ru Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

lab4-2_calcProcedure

.sql
Скачиваний:
2
Добавлен:
20.01.2023
Размер:
1 Кб
Скачать
-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters 
-- command (Ctrl-Shift-M) to fill in the parameter 
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[CalculatorProcedure]
	@opd1 bigint,
	@opd2 bigint,
	@oprt char(1) = '*'
AS
BEGIN
	declare @result bigint;
	set @result =
	   case @Oprt
	     when '+' then @opd1 + @opd2
		 when '-' then @opd1 - @opd2
		 when '*' then @opd1 * @opd2
		 when '/' then @opd1 / @opd2
		 else 0
    end
	
	return @result
END
GO
Соседние файлы в предмете Системы и Методы Управления Базами Данных