[unixODBC-support] Error using dash in table name

Jason Pump jason at healthdash.com
Tue Nov 15 22:23:08 GMT 2005


You either have to quote or escape the dash in the table name, I forget 
which. We decided to never use dashes in table names instead. Your 
statement is interpreted as:

*select * from Source "MINUS" Ownership

*
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
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>unixODBC-support mailing list
>unixODBC-support at easysoft.com
>http://mail.easysoft.com/mailman/listinfo/unixodbc-support
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20051115/dbd81099/attachment.html>


More information about the unixODBC-support mailing list