Reporting Services를 사용하는 방법을 배우려하고 내가 원하는 것을 내보내는 프로젝트로 작업하고 있습니다. 필터를 사용하는 변수를 사용하도록 개선했으며 데이터 집합 쿼리에 변수를 추가하려고합니다.SSRS의 DateTime Picker - Text 쿼리를 사용하여 datetime 매개 변수 전달
여기가 문제가됩니다. 아래는 잘 작동하는 내 쿼리입니다.
DECLARE @reqDateTime VARCHAR(16), @TSQL nvarchar(4000)
SET @reqDateTime = '2014-01-14'
SET @TSQL = 'select convert(datetime, ''<<date>>'') Timestamp, <<other Columns>>
from openquery
(<<server>>, ''SELECT ...etc...'')
order by <<other Columns>>'
SET @TSQL = REPLACE(@TSQL, '<<date>>', @reqDateTime)
exec (@TSQL)
하지만이 값을 변경하고 속성에서 매개 변수를 설정하면 오류가 발생합니다.
코드 :
DECLARE @reqDateTime VARCHAR(16), @TSQL nvarchar(4000)
SET @reqDateTime = @filterByDateTime
SET @TSQL = 'select convert(datetime, ''<<date>>'') Timestamp, <<other Columns>>
from openquery
(<<server>>, ''SELECT ...etc...'')
order by <<other Columns>>'
SET @TSQL = REPLACE(@TSQL, '<<date>>', @reqDateTime)
exec (@TSQL)
매개 변수 이름 : @filterByDateTime
매개 변수 값 : [@AsAt]
매우 중요한 I 인뿐만 아니라, 날짜 시간에 시간을 통과하고 있다는 것입니다 이 데이터 세트를 기반으로합니다 :
select dateadd(mi, datediff(mi, 0, getdate()) - (datediff(mi, 0, getdate()) % 5), 0) [DefaultDateTime]
5 분 증가) : 2014-01-14 17 : 25 : 00.000
내가 쿼리를 설계 할 때 팝업은 @filterByDateTime의 기본값을 묻습니다. '2014-01-14 05:25 : 00 PM '이고 쿼리가 실행되고 행 이름을 가져옵니다.
나는이 메시지가 있지만 빌더에서 보고서를 실행 : 내가 잘못 여기서 뭐하는 거지
For more information about this error navigate to the report server on the local server machine, or enable remote errors
----------------------------
Query execution failed for dataset 'MainDataSet'. (rsErrorExecutingCommand)
----------------------------
An error has occurred during report processing. (rsProcessingAborted)
?