Skip to content
Advertisement

Capture values from a table and declare as a local variable in SQL Function

I’m learning how to write functions in SQL and this might be simple but can’t seem to find what I’m looking for. I have a function as follows:

I want to capture the minimum date and maximum date and use it in my execute function to filter out from my tb1 to get rows of data where the date is between the start and end date.

Advertisement

Answer

Modifications to your code:

For SELECT INTO see SELECT INTO. For USING see Dynamic.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement