Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedures

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
I have never used Stored Procedures before in any database so have no experience with them. My question is a fairly simple one - can I create a stored procedure with one parameter and that use that procedure in a join query with a table?

Apologies if this is really obvious to those Pervasive geniuses out there.

Mighty
 
Only on Pervasive Version 8.
Is it possible to use nested queries. Tried doing this using similar syntax to that used by MS Access but Pervasive didn't like it.

Mighty
 
What kind of nested query? Can you post the Access version, the PSQL version you tried, and the error you got?



Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
I'm trying to run a query similar to the following access query:

SELECT [Part Master].PRTNUM_01, [Part Master].PMDES1_01, IIF(isNull(Query1.QTYOH), 0, Query1.QTYOH) AS stockQty FROM [Part Master] LEFT JOIN (SELECT PRTNUM_06, SUM(QTYOH_06) AS QTYOH FROM [All Part Stock] WHERE NETFLG_06 = 'Y' GROUP BY [All Part Stock].PRTNUM_06) as Query1 ON [Part Master].PRTNUM_01 = [Query1].PRTNUM_06 WHERE [Part Master].COMCDE_01 = 'AB2' ORDER BY [Part Master].PRTNUM_01

The only change I attempted when trying to run this on Pervasive was to change the brackets around the table names to quotes. it just gives a syntax error after the join statement.

Also, there is an error in my last post. I am only running Pervasive SQL 2000i

Mighty
 
As stored procedures don't appear to be an option, I searched a forum for nested queries and from another post it doesn't appear that nested queries are supported in SQL 2000i. From a google search, one suggestion was to create a view for the subqueries and join those to tables.

I have no experience of using views and was wondering what anyones opinion was on that option.

Mighty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top