If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Pervasive.SQL > Exec function/statement

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-15-04, 15:17
Yammieken Yammieken is offline
Registered User
 
Join Date: Jul 2004
Posts: 4
Question Exec function/statement

Hello to everyone reading this topic...

I have a problem with a stored procedure I'm trying to put together for retrieving database information.

Actually it's a simple procedure to build. I want to dynamically form the select depending on some input parameters...

But can anyone help me finding the funtion that's replaces the exec funtion in MS SQL. This funtion executes code put into a variable ...

Example:
DECLARE :strSQL varchar(1000);
SET :strSQL = 'select * from table';

exec(:strSQL) --> but this doesn't work in pervasive.... HELP!!!!


Elly
Reply With Quote
  #2 (permalink)  
Old 07-15-04, 15:27
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
THere is no direct replacement. You'll need to build the select with the variables for example:
select * from table where field = :variable;

Why use a Stored Procedure anyway? You get no realy performance increase from Pervasive since the procedures are not precompiled.
__________________
Mirtheil Software
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development
http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.
Reply With Quote
  #3 (permalink)  
Old 07-20-04, 04:43
Yammieken Yammieken is offline
Registered User
 
Join Date: Jul 2004
Posts: 4
Because I have to....
it's a rather complicated Select statement, well i mean the select and from clause are the same always, but the where depends on the input parameters ...

We have tested and the application we are working is is much faster when you get all the sql statements from stored procedures, so that's why we have to find a way to dynamically build a select statement ....

Pleas help!
Reply With Quote
  #4 (permalink)  
Old 07-20-04, 08:02
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
There is no way to dynamically build the SQL statement and execute it the way you want.
__________________
Mirtheil Software
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development
http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.
Reply With Quote
  #5 (permalink)  
Old 08-15-04, 08:06
KimballJohnson KimballJohnson is offline
Registered User
 
Join Date: Aug 2004
Posts: 51
hmmm...

You should be able to use 'CALL' instead of 'EXEC' within a stored procedure.
Reply With Quote
  #6 (permalink)  
Old 08-30-04, 03:12
Dilyias Dilyias is offline
Registered User
 
Join Date: Feb 2004
Posts: 78
CALL is used to execute a stored proc, not run a sql statement.

If you posted the logic you need maybe we could find a way to implement the various selects you need in a proc.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On