Results 1 to 11 of 11
  1. #1
    Join Date
    May 2006
    Posts
    5

    Question Unanswered: Paradox sql if or case statement

    Is there a Paradox equivalent to SQL IF or CASE statements?

    Thanks,
    karimk

  2. #2
    Join Date
    Dec 2007
    Posts
    366
    there is IF - ELSE - ENDIF and SWITCH - CASE - ENDSWITCH.. both can be found in the OPAL Help without effort..
    --
    Steven Green - Myrtle Beach, South Carolina USA

    http://www.OasisTradingPost.com

    Oasis Trading Post
    - Collectibles and Memorabilia
    - Vintage Lego Sets and Supplies
    - and Paradox Support, too

  3. #3
    Join Date
    May 2006
    Posts
    5

    Paradox sql if or case statement

    I mean SQL statements rather than ObjectPAL. In SQL Server, for example, you can have:

    SELECT
    FullName,
    CASE Dept
    WHEN 'Marketing' THEN 'Sales'
    WHEN 'Customer Care' THEN 'Post Sales'
    ELSE 'Admin'
    END,
    CompanyName
    FROM myTable

    You can also use IF... ELSE in an SQL statement.

    Is there anything like this in Paradox?

    Thanks,
    Karimk

  4. #4
    Join Date
    Dec 2007
    Posts
    366
    look up Local SQL help..
    --
    Steven Green - Myrtle Beach, South Carolina USA

    http://www.OasisTradingPost.com

    Oasis Trading Post
    - Collectibles and Memorabilia
    - Vintage Lego Sets and Supplies
    - and Paradox Support, too

  5. #5
    Join Date
    May 2006
    Posts
    5

    Paradox sql if or case statement

    Your replies are completely pointless! Why don't we all forget about this forum and just use Paradox help!!

  6. #6
    Join Date
    Dec 2007
    Posts
    366
    ok, you can't figure this out yourself.. sorry about that..

    you're using a dead platform, with almost no global support available anymore.. I keep an eye on this forum simply because nobody else with a serious paradox background does, but I haven't touched it myself for several years.. if you need specific assistance with paradox, go to the paradox community web site.. Home - Paradox Community
    --
    Steven Green - Myrtle Beach, South Carolina USA

    http://www.OasisTradingPost.com

    Oasis Trading Post
    - Collectibles and Memorabilia
    - Vintage Lego Sets and Supplies
    - and Paradox Support, too

  7. #7
    Join Date
    May 2006
    Posts
    5

    Paradox sql if or case statement

    Yes that's why I posted the question Sherlock...

  8. #8
    Join Date
    Dec 2007
    Posts
    366
    wow, great attitude.. no, Sherlock Holmes won't know what you're thinking, if you don't bother to explain or ask correctly..

    the BDE's Local SQL does most common SQL stuff.. did you actually try your code first? did it fail? did you look at the help at all? do you have any experience with Paradox, or are going into this cold?

    you're gonna get the same questions on the community forum.. there are people willing to help, but they'll always need to know *your* knowledge level, too..
    --
    Steven Green - Myrtle Beach, South Carolina USA

    http://www.OasisTradingPost.com

    Oasis Trading Post
    - Collectibles and Memorabilia
    - Vintage Lego Sets and Supplies
    - and Paradox Support, too

  9. #9
    Join Date
    Feb 2009
    Posts
    2

    SQL queries

    Try not to be abusive. The people on this site don't get paid to help you and frankly I'm surprised at how many people continue to offer support!

    Create your query in queries and then go to View on the menu bar and show SQL.

    Your pushbutton should use something like this:

    var
    mySql sql
    endvar
    my sql

    paste your code here

    endsql
    MySql.executesql(db,":alias:file name")

    You can then use the results in the database file.

    Works for simple SQL instructions.

  10. #10
    Join Date
    Dec 2011
    Posts
    1
    Having the same problem.

    if then else appears to be reserved keywords in the sql window (and case does not, nor iif), but I'm struggling with the syntax as well, the 10 part local sql in the paradox forum linked above does not mention if then else that I see.



    Curious if you figured this out or went another route.

    I tried if then else as well as if(conditional,true, false) neither seemd to work

    select *
    if subdiv="$$"
    then substring(a."DESC" from 11 for 7)
    else cast(cast(DIV as int) as char(10)) +"/"+ subdiv
    from "upldje.db" a

  11. #11
    Join Date
    Dec 2007
    Posts
    366
    Ceetar.. if the examples you found on the community site don't help, you need to ask more questions THERE.. you're trying to use BDE Local SQL for your SQL side, so only folks working with BDE will be able to answer correctly (usually Paradox or Delphi folks).. your best bet for help is Home - Paradox Community
    --
    Steven Green - Myrtle Beach, South Carolina USA

    http://www.OasisTradingPost.com

    Oasis Trading Post
    - Collectibles and Memorabilia
    - Vintage Lego Sets and Supplies
    - and Paradox Support, too

Posting Permissions

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