Hi,
The following execution gives me the error - expected 4 arguments, got 0.
DECLARE @SQL_Query as VARCHAR(MAX)
SET @SQL_Query = ‘SELECT 1 from <Some_DB>.dbo.<Some_Table>
where job_time between $__timeFrom() and $__timeTo()’
EXEC(@SQL_Query)
If I run below, it executes fine -
SELECT 1 from <Some_DB>.dbo.<Some_Table>
where job_time between $__timeFrom() and $__timeTo()
Comment out the exec and run it
or use this instead
DECLARE @SQL_Query as VARCHAR(MAX)
SET @SQL_Query = 'SELECT 1 from <Some_DB>.dbo.<Some_Table>
where job_time between $__timeFrom() and $__timeTo()'
--EXEC(@SQL_Query)
SELECT @SQL_Query
vs
DECLARE @SQL_Query as VARCHAR(MAX)
SET @SQL_Query = concat('SELECT 1 from <Some_DB>.dbo.<Some_Table>
where job_time between ''', $__timeFrom(), ''' and ''', $__timeTo(), '''')
SELECT @SQL_Query
--EXEC(@SQL_Query)
Then post back if what you see is a legit SQL query