I am new to SQL Sg server and am trying to run code using the create function to convert a price fro USD to decimal. I'm getting the following flag
"Incorrect Syntax: 'Create Function' must be the only statement in the batch.
Can anyone point out what I'm dong wrong? Thank you!
CREATE FUNCTION week3.ConvertToEuro ( @priceUSD decimal(5,2))
returns decimal (5,2)
begin
declare @PriceEuro decimal (5,2)
set @PriceEuro =(@priceUSD * .89)
return @PriceEuro
end
SELECT TOP (1000) [ProductName]
,[price]
,week3.ConvertToEuro(price) as PriceEuro
FROM [AA5100_edmistonml].[Week3].[productprice]
SQL Server 2019is not yet released.