This is a migrated thread and some comments may be shown as answers.

Use declare in report datasource

1 Answer 123 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 2
Joe asked on 07 Jan 2011, 07:33 PM
Is there away to create a report based on the following SQL querie:

declare @date smalldatetime
select @date = GETDATE()
select @date = CONVERT(varchar(12),getdate(),101)
  
SELECT PEERS.COMPANY_NAME, PEERS.ASN, EXCHANGES.EXCHANGE_NAME, PEERINGS.CREATED
FROM EXCHANGES 
  
INNER JOIN PEERINGS ON EXCHANGES.EXCHANGE_ID = PEERINGS.EXCHANGE_ID 
INNER JOIN PEERS ON PEERINGS.PEER_ID = PEERS.PEER_ID
  
  
WHERE PEERINGS.CREATED BETWEEN @date + '00:00' AND @date + '23:59'

It appears that the use of declare is not supported.

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 12 Jan 2011, 06:57 PM
Hello Joe,

Variables are declared in the body of a batch or procedure with the DECLARE statement but the SqlDataSource is Executing Queries. Thus if you have to use the Declare statement our suggestion is to utilize stored procedures.

Regards,
Peter
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
Tags
General Discussions
Asked by
Joe
Top achievements
Rank 2
Answers by
Peter
Telerik team
Share this question
or