SQL Server 2008 R2
I have a stored procedure (simplified) for a SSRS report. The report runs fine but I'm getting an error using a 3rd party product relating to converting parameter value from a String to DateTime.
ALTER PROCEDURE [dbo].[usrsp_S_Activity]
@Start Date,
@End Date,
AS
SELECT
CLIENT.NAME
,CLIENT.CLIENT_ID
,ACT_LOG.CREATE_DATE
,CLIENT.ACTIVE_IND
,Convert(Date,ACT_LOG.CREATE_DATE)AS 'DT_CREATE'
FROM
[CSPRDWEBSRV].[ACTIVITY].[dbo].[CLIENT] CLIENT
INNER JOIN
[CSPRDWEBSRV].[ACTIVITY].[dbo].[ACT_LOG] ACT_LOG ON CLIENT.CLIENT_ID = ACT_LOG.CLIENT_ID
WHERE
ACT_LOG.CREATE_DATE BETWEEN (@Start) and (@End)
The problem I am having is a result the "CREATE_DATE" being stored in the database as varchar(50)and this unfortunately cannot be changed. In the database, the field is formatted 'm/d/yyyy' (sample values: 1/1/2017 and 2/28/2017).
Is there a better way to write the stored procedure format the date?
(I also posted this to SSRS but that forum does not get any action.)
Thanks so much!
- Jackie
I have a stored procedure (simplified) for a SSRS report. The report runs fine but I'm getting an error using a 3rd party product relating to converting parameter value from a String to DateTime.
ALTER PROCEDURE [dbo].[usrsp_S_Activity]
@Start Date,
@End Date,
AS
SELECT
CLIENT.NAME
,CLIENT.CLIENT_ID
,ACT_LOG.CREATE_DATE
,CLIENT.ACTIVE_IND
,Convert(Date,ACT_LOG.CREATE_DATE)AS 'DT_CREATE'
FROM
[CSPRDWEBSRV].[ACTIVITY].[dbo].[CLIENT] CLIENT
INNER JOIN
[CSPRDWEBSRV].[ACTIVITY].[dbo].[ACT_LOG] ACT_LOG ON CLIENT.CLIENT_ID = ACT_LOG.CLIENT_ID
WHERE
ACT_LOG.CREATE_DATE BETWEEN (@Start) and (@End)
The problem I am having is a result the "CREATE_DATE" being stored in the database as varchar(50)and this unfortunately cannot be changed. In the database, the field is formatted 'm/d/yyyy' (sample values: 1/1/2017 and 2/28/2017).
Is there a better way to write the stored procedure format the date?
(I also posted this to SSRS but that forum does not get any action.)
Thanks so much!
- Jackie