Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2004
    Posts
    4

    Red face Unanswered: Query Pervasive Table.

    I'm trying to query a Pervasive table with two-word name.

    Example: "select * from Table 1"........ but an error always occurs. I try
    this: "select * from [Table 1]" but it also doesn't work.

    I tried to query other tables but with only a single name and no error occurs. So this is a syntax error in Pervasive.

    What is the correct syntax for this. Anybody there who can help me.............

  2. #2
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    You need to use double quote around tables with spaces in the name. So in your example, it should be:
    Select * from "Table 1"
    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
    Feb 2004
    Posts
    4
    I also ried that but the same error occurs. I'm actually doing the query in Visual Basic. When you try to queyr there, the syntax must be:

    "select * from Table 1"............. you need to put open/close double qoute. so if i will try your suggestion it will be:

    "select * from "Table 1""........... and 'Syntax Error' occurs..........

    Have you already encountered this? THANK YOU VERY for your reply. I appreciate it so much. But I think it's not the right solution to my problem. Thank you again.


    Originally posted by mirtheil
    You need to use double quote around tables with spaces in the name. So in your example, it should be:
    Select * from "Table 1"

  4. #4
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    The only double quotes need to be around the table name. What version of Pervasive are you using? What tool are you using to issue the statemtn?
    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
    Feb 2004
    Posts
    78
    You must be new to VB. To include quotes in a string you must use "".

    So, try something like this:

    sSql = "select * from ""Table 1"""

  6. #6
    Join Date
    Feb 2004
    Posts
    78
    ALSO, First verify your queries work in the Sql Data Manager. It's like Query Analyser if you have used Sql Server.

  7. #7
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    Another way to specify double quotes in VB would be:
    SQL = "Select * from " & chr$(34) & "Table 1" & chr$(34)
    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.

  8. #8
    Join Date
    Feb 2004
    Posts
    78
    Originally posted by mirtheil
    Another way to specify double quotes in VB would be:
    SQL = "Select * from " & chr$(34) & "Table 1" & chr$(34)
    Yes, but that's sooo much typing! I prefer "" because it is the same in sql (two single quotes) and makes it second nature in both languages..

    Of course, all those quotes can get confusing!

    Sometime I'd do something like :

    q = chr$(34)

    sSql = "select * from " & q & "table 1" & q
    Last edited by Dilyias; 02-26-04 at 21:57.

  9. #9
    Join Date
    Feb 2004
    Posts
    4
    OKEY!!!!!! Thank you very much!!!! It already works..... Thank you.

  10. #10
    Join Date
    Feb 2004
    Posts
    78
    Originally posted by poknad_03
    OKEY!!!!!! Thank you very much!!!! It already works..... Thank you.
    LOL, ..glad we could be of help!

    -Eric

Posting Permissions

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