how can i wirte the ms sql server sql in query?

for example :

declare @bgdt datetime,@eddt datetime
set @bgdt=@begindate
set @eddt=@enddate

how can i write the sql in jasperreport dataset?

597290358's picture
Joined: Nov 28 2022 - 6:00pm
Last seen: 1 month 2 weeks ago

Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit for direct access to our technical support teams offering guaranteed response times.

mrajkuma - 3 months 3 weeks ago

Minor note - if you're hosting these reports on jasper server, you'll need to set the 'language' attribute on the <queryString> element to 'plsql' to support the 'call' keyword, so <queryString language="plsql"; alternatively you can change the sql validator on the properties file on jasper. If the 'langauge="plsql" approach doesn't work, look into the validator. 

darth_fader - 3 months 3 weeks ago

1 Answer:

Move your code into a stored procedure then use a data adapter with plsql language.  That plsql language is not just for Oracle but it works on sql server too.  When you change the SQL language a new default parameter is created as $P{ORACLE_REF_CURSOR} which holds the result of the procedure.

Here is an example of how to call a stored procedure:


jgust's picture
Joined: Jun 10 2010 - 6:39am
Last seen: 1 day 7 hours ago