
IF EXISTS (SELECT * FROM sys.objects WHERE name=N'fnFiyatGor' AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
	DROP FUNCTION [dbo].[fnFiyatGor];
	
GO

CREATE FUNCTION [dbo].[fnFiyatGor](@Barkod VARCHAR(50))
	RETURNS FLOAT
	AS
	BEGIN
	
		DECLARE @Result FLOAT;

		SET @Result=666;

		RETURN @Result;

END

GO

IF EXISTS (SELECT * FROM sys.objects WHERE name=N'fnStokIsmi' AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
	DROP FUNCTION [dbo].[fnStokIsmi];
	
GO

CREATE FUNCTION [dbo].[fnStokIsmi](@Barkod VARCHAR(50))
	RETURNS nVARCHAR(255)
	AS
	BEGIN
	
		DECLARE @Result nVARCHAR(255);

		SET @Result='FONKSIYON ICI BOS';

		RETURN @Result;

END

GO

IF NOT EXISTS (SELECT * FROM sys.objects WHERE type='U' and name = 'FIYAT_SCALAR_FONKSIYONLAR_ICINDE') BEGIN
	CREATE TABLE FIYAT_SCALAR_FONKSIYONLAR_ICINDE(
		nId int IDENTITY(1,1) NOT NULL PRIMARY KEY,
		fonksiyonlaraBakiniz nvarchar(50) NULL
	);
END

GO