sql server stored procedures in jaspersoft studio 5.6 - sql-server-2008

I have a stored procedure my_sp which takes in two parameters, first an integer and then a date. That is,
EXEC my_sp 265522,'6-10-15'
I have been trying to design a report based on the result set from this procedure in Jaspersoft Studio 5.6. The report does not generate or atleast takes way too long if I use the two parameters though the output data consists of only 25 rows. I am using this query,
exec my_sp $P{param1} , $P{param2}
and feel the probelm is with the syntax only. Also the same query works perfect when I had tried it in Sql Server Management Studio and in jaspersoft studio, stored procedures with a single parameter work like magic. Kindly help me out on this

This should absolutely work.
Add an ! after the P of each parameter
Is the SP creating temp tables? If so try another driver OR create another SP that returns the result of this SP
Try another driver anyway
add the #paramname from tsql = $P{} instead of anonymously naming them

Related

MySQL + SSRS | Stored Procedure only returns one single row

I'm working on several reports for SSRS written in MySQL via ODBC Adapter. For some reason, Stored Procedures only return a single row of data instead of an expected set of data.
Below is the same stored procedure when ran on an SQL Editor:
And below is the stored procedure's execution result when SSRS tries to run it (both on Query Designer and Report Viewer):
I have also set parameters properly as far as i can tell:
so i wasn't able to find an exact answer as to why this happens on SSRS with MySQL via ODBC. What i was able to find was a workaround:
by executing the command as an Expression rather than as a raw query via the Query Editor:
Now the only caveat for this is that the DataSet Fields wouldn't be automatically generated, and that you have to plot them all manually. A good workaround for this is to first run a blank/null query with only the column names (i.e.: SELECT NULL 'column_name_1', NULL 'column_name_2') then later change the query source to Expression. The good thing about using expression is that you only need minor knowledge about how it works and it reduces the confusion with ODBC '?' Parameters.
Cheers!

Can Google Data Studio call a MySQL stored procedure with parameters and consume the result set?

All--
(Ducking to avoid the flames....) I would like to use Google Data Studio to create simple reports from MySQL data. For each of several reports, I have written a corresponding MySQL stored procedure that has a single parameter, pEndDate (a CHAR(10) string in the format yyyy-MM-dd). It seems simple enough to use MySQL tables and views as data sources for Google Data Studio, but I haven't seen any documentation or blog posts re: stored procedures. Any and all comments are welcome.
Thanks,
Matthew P. Seltzer
P.S. I am running MySQL 5.6 on Windows 10 Pro.
MPS
You may try making the stored procedure a function then you can call that in a SELECT, you may need to experiment a bet with getting the function to trigger before the datasource selecting from the views and tables, but it's worth a shot.

Call a Stored Procedure in SSIS Data Source

I am trying to call a stored procedure in SSIS OLE- DB DataSource (My Datasource would be SQL Server 2012).
I tried a procedure call SQL statement under SQL Command option but when I click the preview button I am getting an error.
Please guide me how to resolve this error. I goolged but nothing works for me.
I think the issue you are having is in SSIS often takes the first Select statement it finds and tries to validate it for column names, this happens especially with very big procedures. The trick I have found to get this to work is, right off the bat throw something like :
IF 1 = 0
Begin
Select all columns you want
END
This code will never get execute but it hints SSIS to make those columns the ones in the data flow. Just be sure to update this list as you update your last select.

Can I write a stored procedure in Query Builder within SSRS?

I want to run the following procedure first:
exec ep_upd_server_abc
Then execute the following statement:
SELECT * FROM dbo.Server_Warehouse
WHERE Enabled = 'f' and disabledweekly = 'f'
Can I write the following procedure in SSRS Query Builder so that I can execute two statements?
CREATE PROCEDURE ShowDBJob
As
Begin
exec ep_upd_server_abc;
SELECT * FROM dbo.Server_Warehouse
WHERE Enabled = 'f' and disabledweekly = 'f'
End
Is there a work around for this?
I tried running this in SSRS Query Builder and it's giving me an error. Would appreciate any thoughts and suggestions...Thanks!!
Why not just do this exact procedure for
CREATE PROCEDURE ShowDBJob
As
Begin
exec ep_upd_server_abc;
SELECT * FROM dbo.Server_Warehouse
WHERE Enabled = 'f' and disabledweekly = 'f'
End
in SQL Management Studio and call that? Don't do any type of real time event driven coding or procs in SSRS IMHO. Slippery slope where you are trying to use the equivalent of a screwdriver for a hammer and vice versa. SQL Managment studio is meant for designing proc's and accessing the SQL Server Database for it's object creation directly. SSRS is meant to return data connections, results for a dataset, evaluating presentation of datasets on one or many objects to display and not much more except features/syntax around those things. Even accessing temp tables '#(something)' and parameters declared on the fly 'declare #thing int (inside statement of dataset)' make it get mad. Stick with predefined programable objects or procedures and functions already created. Do not try to create them on the fly.
Plus think about this. Everytime you are calling your dataset you cannot create that object each time as it already exists. Then you are going to have to either alter it or drop it and recreate it first. SSMS already does this part in options for you and stores them in the database. SSRS is an add on to SQL Server but is not full featured for creating objects. Especially on the fly.
No, You cannot write "Create Procedure" or any other DDL statements from Query Designer in RS. This is by design.

How do I make a stored procedure in MS Access?

How do I make a stored procedure in MS Access?
Access 2010 has both stored procedures, and also has table triggers. And, both features are available even when you not using a server (so, in 100% file based mode).
If you using SQL Server with Access, then of course the stored procedures are built using SQL Server and not Access.
For Access 2010, you open up the table (non-design view), and then choose the table tab. You see options there to create store procedures and table triggers.
For example:
Note that the stored procedure language is its own flavor just like Oracle or SQL Server (T-SQL). Here is example code to update an inventory of fruits as a result of an update in the fruit order table
Keep in mind these are true engine-level table triggers. In fact if you open up that table with VB6, VB.NET, FoxPro or even modify the table on a computer WITHOUT Access having been installed, the procedural code and the trigger at the table level will execute. So, this is a new feature of the data engine jet (now called ACE) for Access 2010. As noted, this is procedural code that runs, not just a single statement.
If you mean the type of procedure you find in SQL Server, prior to 2010, you can't. If you want a query that accepts a parameter, you can use the query design window:
PARAMETERS SomeParam Text(10);
SELECT Field FROM Table
WHERE OtherField=SomeParam
You can also say:
CREATE PROCEDURE ProcedureName
(Parameter1 datatype, Parameter2 datatype) AS
SQLStatement
From: http://msdn.microsoft.com/en-us/library/aa139977(office.10).aspx#acadvsql_procs
Note that the procedure contains only one statement.