[freetds] Error when table name contains a dash "-"

Razvan Cosma razvan.cosma at telemach.com
Mon Nov 14 06:45:32 EST 2005


Same error happens when using freetds from Perl's DBD::Sybase. The
solution is to enclose the db name in square brackets [db-name]
HTH

bruce.x.bushby at jpmchase.com wrote:

>Hello
>
>I was wondering if there is a known problem when attempting to query 
>tables with a dash "-" in their name?
>Everything works perfectly except when I attempt to query a table who's 
>name contains dashes.
>
>System info:
>[bbushby at s2013 src]$
>[bbushby at s2013 src]$ uname -a
>Linux s2013 2.4.21-15.0.4.ELsmp #1 SMP Sat Jul 31 01:25:25 EDT 2004 i686 i686 i386 GNU/Linux
>[bbushby at s2013 src]$ rpm -qa | grep -i unixodbc
>unixODBC-kde-2.2.8-2.3.0.2
>unixODBC-2.2.8-2.3.0.2
>unixODBC-devel-2.2.8-2
>[bbushby at s2013 src]$ ls -ld freetds-0.64.dev.20051111
>drwxr-xr-x    8 bbushby  bbushby      4096 Nov 12 18:44 freetds-0.64.dev.20051111
>
>Example:
>[bbushby at s2013 src]$
>[bbushby at s2013 src]$ isql -v TIDE t****** ******
>+---------------------------------------+
>| Connected!                            |
>|                                       |
>| sql-statement                         |
>| help [tablename]                      |
>| quit                                  |
>|                                       |
>+---------------------------------------+
>SQL> sp_helpuser;
>+---------------+-----------------+-----------------------------------------------+---------------+-------+-----------------------------------------+
>| UserName      | GroupName       | LoginName        | DefDBName     | 
>UserID| SID                                     |
>+---------------+-----------------+-----------------------------------------------+---------------+-------+-----------------------------------------+
>| dbo           | db_owner        | SLDN60VEBIBD01\LocalMgr        | 
>master        | 1     | 010500000000000515000000a837d665235f636b|
>| remote        | public          | remote        | Tideway       | 7 | 
>a400af1cf3cad548a9cb480e5a992fae        |
>| tideway       | db_owner        | tideway        | Tideway       | 6 | 
>4fa64e3bc5859a489079d68ca6531755        |
>| U790159       | db_owner        | U790159        | Tideway       | 5 | 
>c4b5f325421bd14eaf8b6a58d25d1ed4        |
>+---------------+-----------------+-----------------------------------------------+---------------+-------+-----------------------------------------+
>SQLRowCount returns -1
>4 rows fetched
>SQL> select * from Source-Ownership;
>[37000][unixODBC][FreeTDS][SQL Server]Line 1: Incorrect syntax near '-'.
>[][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared.
>[ISQL]ERROR: Could not SQLPrepare
>SQL>
>
>
>
>Could this be a FreeTDS issue?
>
>Any help much appreciated.
>Regards
>Bruce Bushby
>_______________________________________________
>FreeTDS mailing list
>FreeTDS at lists.ibiblio.org
>http://lists.ibiblio.org/mailman/listinfo/freetds
>  
>


More information about the FreeTDS mailing list