Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I am trying to execute the following stored procedure but i am getting errors... any advice?
EXECUTE sdobj.GETSTNGROSSAMOUNT (#coson) from sddta.cusord where #coson=800300
I have never used stored procedures before so I am not sure if the above script is correct..
Thxs,
Alec
First step is that you have to create a variable for each parameter you need to pass to the Store Procedure. In this example, let's suppose you just have a single date parameter:
let vDate = '2013-01-01' //here is important to use the same format that is used in the database
Store_Procedure_table:
Load * ;
SQL EXECUTE DB.OWNER.STORE_PROCEDURE '$(vDate)'; //with the last part you're passing the needed parameter
If you had several parameters you can separate them with commas and alwas with the $-expansion and between single quotes,
Regards.
Siva
Hi,
Try like this
LET coson = 'StoredProcedureParameterValue';
TableName:
SQL EXECUTE sdobj.GETSTNGROSSAMOUNT ($(StoredProcedureParameterValue)) ;
Where your stored procedure in the database should have the following code
CREATE PROCEDURE sdobj.GETSTNGROSSAMOUNT
(
value INT
)
BEGIN
SELECT * from sddta.cusord where #coson=value
END
Hope this helps you.
Regards,
Jagan.
Hi,
Please try the following code:
SQL
EXEC ProcedureName
@Parameter1='Data',
@Parameter2='Data'
;
SQL SELECT *
FROM TemptableName;
In this TemptableName is the table in which the procedure stores the output.
Hope this helps.
-Shruti
Hi guys,
Thank you for the details however none of them helped..
Anybody can help and give me how my script should look like to query the stored procedure giving the above details?
As I said I'm not an expert when it comes to stored procedures.
Thxs for your help.
Alec
Hi,
Do you have stored procedure in the stored procedure in the database? If not then you have to create it in database, or else if it is a query you can just directly execute that query like
TableName:
SQL SELECT * from sddta.cusord where #coson=800300;
Hope this helps you.
Regards,
Jagan.
Hello,
Thank you for your help but SQL SELECT * from sddta.cusord where #coson=800300; doesn't bring what I am looking for and yes there is a stored procedure in the database..
Thxs,
Alec
The first thing i wold try is to execute the SQL statement on the server to make sure it works.
So try
SELECT * from sddta.cusord where #coson=800300
on your SQL server