Initial commit
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Functions].[does_product_exist_with_name]') IS NOT NULL
|
||||
DROP FUNCTION [Functions].[does_product_exist_with_name];
|
||||
GO
|
||||
CREATE FUNCTION [Functions].[does_product_exist_with_name](
|
||||
@name AS NVARCHAR(128)
|
||||
)
|
||||
RETURNS BIT
|
||||
AS
|
||||
BEGIN
|
||||
IF EXISTS (
|
||||
SELECT *
|
||||
FROM [Tables].[products]
|
||||
WHERE [name] = @name
|
||||
)
|
||||
RETURN CAST(1 AS BIT);
|
||||
RETURN CAST(0 AS BIT);
|
||||
END
|
||||
Reference in New Issue
Block a user