I am currently using SQL Server 2012 and Visual Studio 2012 for my projects.
My question is I have the following code below and it contains declare variables. Basically, when I use it in my SQL server I set @StartDate to the 1st of current month and the @EndDate to the last day of current month (December.)
DECLARE @StartDate date
DECLARE @EndDate date
-- SET @StartDate = '20161201'
-- SET @EndDate = '20161231'
SELECT A.[TYPE_NAME], -- Type_Name
A.[STRT_DTTM], --Start Date
A.[END_DTTM], --End Date
B.[ASSIGNED_DT], --Assigned Date
CASE WHEN (CAST(A.[STRT_DTTM] AS DATE) <= @EndDate AND (CAST(A.[END_DTTM] as date) > @EndDate OR A.[END_DTTM] IS NULL))
THEN 1
ELSE 0
END AS 'OpenIndicator',
CASE WHEN CAST(A.[END_DTTM] as DATE) between @StartDate AND @EndDate
THEN 1
ELSE 0
END AS 'ClosedIndicator',
CASE WHEN CAST(B.[ASSIGNED_DT] as DATE) between @StartDate AND @EndDate
THEN 1
ELSE 0
END AS 'AssignedIndicator',
FROM Report AS A
INNER JOIN Dimension AS B
ON A.[ID] = B.[ID]
WHERE 1=1
AND A.[EXPIRE_DATE] = '12/31/9999' --Expire Date (Basically looking for active records.)
AND (A.[TYPE_NAME] like '%Bicycle%'
OR A.[TYPE_NAME] like '%Car%')
So far in SSRS I have placed the above code into a dataset. I also have created the 2 parameters in SSRS StartDate and EndDate. When I try to run a simple tablix based off the dataset...nothing appears.
I commented out the SET @StartDate = '20161201' and SET @EndDate = '20161231'.
I'm very limited with what I can do at work, so I can't use stored procedures unfortunately as well, because that could make it easier I think.
But I am trying to populate a Sales like dataset by what the user inputs into the two parameters StartDate and EndDate but I am having trouble with that in SSRS. Can anyone please help me exactly on what to do, I'm very lost.
Tried to comment in the code to make it easier to understand and had to change some things around due to not trying to get in trouble at work too.
