I want to create a function that returns a temporary date table for generating a report. I want to specify a dynamic spacing for a table. Below is a function that encapsulates my problem.
Consider:
CREATE FUNCTION [dbo].[DateAdder] (@DateStart datetime, @increment int, @interval ?????) Returns datetime AS BEGIN Declare @Return datetime SELECT @Return = DATEADD(@interval, @increment, @DateStart) return @Return END
Is there a way to pass the Interval to this function?
(Obviously, I'm not trying to rewrite the DATEADD function, I just use this as an example to highlight my problem).
Hooray!
source share