Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 30, 2012 01:04 PM by aabruzzese
Apr 27, 2012 09:24 PM|LINK
Apr 27, 2012 11:05 PM|LINK
I did a test with the function below and it worked normally:
CREATE FUNCTION [dbo].[GetTestTableVar]
@Par1 int, @Par2 int, @Par3 int
DECLARE @TableVar table (DateCol date);
insert into @TableVar
select DATEADD(month, @Par1, GETDATE())
select DATEADD(month, @Par2, GETDATE())
select DATEADD(month, @Par3, GETDATE()) ;
DECLARE @Return int;
if Exists (select 1 from @TableVar where DATEDIFF(month, GETDATE(), DateCol) > 3)
SET @RETURN = 1;
SET @Return = 0;
Hope this helps.
Apr 28, 2012 01:14 AM|LINK
I will give it a try on Monday, funny enough that your example is pretty close to how i made my function, maybe its some small little detail that I am just not seeing at the moment but I will let you know on monday.
Also I am on SQL Server 2005, who knows maybe there is some particularity,
Apr 30, 2012 01:04 PM|LINK
I did some checking and testing and finally got it working, your sample helped clarify that it does work on my end and I just needed to do a little more digging.