We help IT Professionals succeed at work.

UNIDAC stored procedure step by step

Vaalar
Vaalar asked
on
Hi,
I want to ask you about some manual how to use Stored Procedures by UNIDAC components.
I was unable to find any manuals on manufacturer web page.
Maybe the best option would be some example with SELECT FROM:
SELECT FROM EXAMPLE WHERE ID>0

Comment
Watch Question

Hello there what is it u are trying to run a query for and im sure i will be able to help u.

Author

Commented:
I want to excercise a little bit before I start to use it.
here is a query which i would like to change for stored procedure:
with UNIQuery12,SQL do
           begin
              Close;
              Clear;
              Add('INSERT INTO PRODUKCJACF (DATA, CZAS, MASA, WYDAJNOSC) SELECT * from PRODUKCJACF_TEMP');
              Execute;
           end;
I know how to create a stored procedure in MS SQL Server but not in UNIQuery. i dont know if that will help you or not? i can give you the code and u can always give it a try if you like?
/*
Name:  usp_displayallusers
Description:  displays all records and columns in USERLIST table

CREATE PROCEDURE usp_displayallusers

AS

SELECT * FROM USERLIST

-------------------------------------------

to run the stored procedure go to stored procedure window and type

exec usp_displayallusers

Author

Commented:
Neo i have found a several examples which shows how to use stored procedures in SQL - the problem is that i have no idea how to use it with UNIDAC components.
Thx anyway.
took me alot of googleing but i found an example for you..

here is the link i found it at is describes how to do them in delphi too.

http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_using_sps
CREATE PROCEDURE GET_EMP_PROJ (EMP_NO SMALLINT)
	RETURNS (PROJ_ID CHAR(5))
	AS 
	BEGIN
	 FOR SELECT proj_id
	  FROM employee_project
	  WHERE emp_no = :emp_no
	  INTO :proj_id
	 DO
	  SUSPEND;
	END

Open in new window

ooh and the example is  an example of a SELECT procedure which returns all the projects an employee is currently assigned.

Author

Commented:
Neo thx for all info. Please tell me how does it look from mssql side.
Should I create stored procedures on mssql server first or just put this code into my statement and run.
im pritty sure you need to create the stored procedure in the query window of your MS SQL Server database. and then put the code into your statement and run.

Author

Commented:
OK. now i know what we are talking about.
Can you tell me am I able to script all stored procedures if i generate script for my database.
I need this to be able to make an installation file.
I`m using Management Studio Express.
yes not a problem i found a helpful link here which tells you exactly how to do it and in what order.

http://ask.sqlservercentral.com/questions/98/generate-script-file-for-each-stored-procedure

Author

Commented:
thx for help.
no problem