I'm receiving the above error when trying to create a function in SQL Server.
I've tried the suggested solution in this question with no luck. I've also tried removing the '>' (so it's just '=') and the error switches to the '='. I have Redgate Tools installed, and I originally used a code snippet to generate the Create Function text. However, even if I start a new blank query file and type out the text manually, I get the same error. I've tried changing the data type of the variable. I'm stumped. I can't find anything actually wrong with the syntax.
create function [dbo].[is_valid_date] (@date sql_variant)
returns bit
as
begin
declare @ret bit;
select @ret = (
@date >= '1753-01-01'
and @date <= '9999-12-31:23:59:59.9999'
);
return @ret;
end
go
Any suggestions?