Skip to Content.
Sympa Menu

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

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Razvan Cosma <razvan.cosma AT telemach.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Error when table name contains a dash "-"
  • Date: Mon, 14 Nov 2005 13:45:32 +0200

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@s2013 src]$
>[bbushby@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@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@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@s2013 src]$
>[bbushby@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
>
>




Archive powered by MHonArc 2.6.24.

Top of Page