Maybe I'm answering this a bit late and you already have a solution. Let me 
just say that I have an application where the defines are used by the select 
statement, but the problem is scope.

If you #define in the very method that runs the SQL statement you are ok, but 
if the define is elsewhere, it will not be seen

Rafael Copquin

  ----- Original Message ----- 
  From: Jon Westcot 
  To: [EMAIL PROTECTED] 
  Sent: Tuesday, September 11, 2007 11:42 PM
  Subject: Can a #DEFINE constant be used in a SQL SELECT statement?


  Hi all:

      I'm trying to generalize an application that I've been maintaining for
  several years and have hit a bit of a brick wall.  I've been trying to set
  up a number of #DEFINE values that get loaded by the uppermost object in the
  application that are then used throughout the rest of the application.  This
  approach has worked nicely except for one situation: I can't seem to make it
  work when I issue a SELECT statement.

      For example:

      In an included header file:

      #DEFINE TYPE_TOOL_SEQ   998
      #DEFINE TYPE_FEES_SEQ  999

      Then, later on, in a SELECT statement:

      SELECT * FROM table WHERE rec_seq < TYPE_TOOL_SEQ

      I get a run-time error telling me that the variable TYPE_TOOL_SEQ is not
  defined.  I thought that, under the covers, the compilation of the
  application would convert the code into something like:

      SELECT * FROM table WHERE rec_seq < 998

      even though it would continue to appear as I typed it above.

      Is there a way to make this work?  Or do I need to do something somewhat
  less appealing, like put these constants into an INI file or into the
  Registry?

      Thanks for any help you can send my way.

      Jon



[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to