Table names in Microsoft SQL with hypen

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Table names in Microsoft SQL with hypen

    Hi.
    I want to access some tables in a Microsoft SQL 2000 database. But the tables
    has names with the character "-" (hypen).
    I understand that this is not "legal" in normal SQL, but an "extension" in
    Microsoft SQL.
    My problem is that I can not make SELECT queries to theese tables. Queries to
    other tables (without hypen in the name) in the same database is woring fine.

    I have tried several suggestions with characters like ' and [ around the table
    name in the query without success.
    I have also tried
    - Updataing the Microsoft SQL 2000 driver
    - Updated DataDirect JDBC drivers (version 3.5)
    - Configuring the Microsoft SQL Server 2000 JDBC driver

    Sadly, I may not change the table names. The database is a part of a big
    soloution for imposition and printing newspaper pages.
    For a long time I have been looking for somebody with a similar problem
    without success.

    Can anybody help me?


    Eindride Guest

  2. Similar Questions and Discussions

    1. Database table names
      In the database tab of the Application panel, when I go down the hierachy to the tables dreamweaver shows the full path instead of just the table...
    2. Microsoft SQL 2000 - table names
      Hi. I want to access some tables in a Microsoft SQL 2000 database. But the tables has names with the character "-" (hypen). I understand that this...
    3. How best to grab SQL table names?
      I've got a script that goes through SQL files and returns an array of table names. To find table names I use: while ($_ = <FILE>) { if ($_ =~...
    4. Access table names
      That depends on exactly what you are doing. But basically 'work' is a keyword, which is why the problem occurs. If you reference it as it...
    5. Dataset and table names.....
      I have a stored procedure that queries a sql server database and returns the multiple data tables ( 7 to be precise) these tables are the results of...
  3. #2

    Default Re: Table names in Microsoft SQL with hypen

    this syntax doesnt work?
    SELECT [au_fname], [au_lname]
    FROM [pubs].[dbo].[authors]
    ORDER BY [au_lname] ASC, [au_fname] ASC
    kim il sung Guest

  4. #3

    Default Re: Table names in Microsoft SQL with hypen

    Here is an example of a query that does not work:

    <cfquery name="Recordset1" datasource="ArkitexMain">
    SELECT *
    FROM dbo.Tb2005-09-12$NAT$ONE$$_
    </cfquery>

    PS! Tablenames with the "$"-character works OK. The problem is the "-" (hypen).

    Eindride Guest

  5. #4

    Default Re: Table names in Microsoft SQL with hypen

    Originally posted by: Eindride
    Here is an example of a query that does not work:

    <cfquery name="Recordset1" datasource="ArkitexMain">
    SELECT *
    FROM dbo.Tb2005-09-12$NAT$ONE$$_
    </cfquery>

    PS! Tablenames with the "$"-character works OK. The problem is the "-" (hypen).

    kim il sung suggested square brackets. Did you try that?


    Dan Bracuk Guest

  6. #5

    Default Re: Table names in Microsoft SQL with hypen

    Thank You! Thank You! Thank You! Thank You! Thank You!

    I have tried a lot with square brackets around the "hole name" like:
    FROM [dbo.Tb2005-09-12$NAT$ONE$$_]

    But the solution was very simple:
    FROM dbo.[Tb2005-09-12$NAT$ONE$$_]

    I?m very happy right now! Tell me what to do in return.

    Thank You kim il sung and Dan



    Eindride Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139