Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2004
    Posts
    4

    Question Unanswered: 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

  2. #2
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    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.

  3. #3
    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!

  4. #4
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    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.

  5. #5
    Join Date
    Aug 2004
    Posts
    51

    hmmm...

    You should be able to use 'CALL' instead of 'EXEC' within a stored procedure.

  6. #6
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •