I’m trying to work with a legacy SQL Server database where some of the
table names have spaces in them.
I’ve done set_table_name “tablename with spaces”, but I can’t get
find(:all) to work. I get the following error (because apparently
it’s not putting [ ] around the name as is required for SQL Server for
names with spaces.
log': DBI::DatabaseError: Execute (ActiveRec ord::StatementInvalid) OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server Incorrect syntax near the keyword 'all'. HRESULT error code:0x80020009 Exception occurred.: SELECT * FROM all wells with apis from c:/ruby/lib /ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/sq lserver_adapter.rb:467:inselect’
select_all' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_recor d/base.rb:431:infind_by_sql’
I see from the exception method that it hasn’t delimited the table
name. There may be more than one way to do this in T-SQL, but what
I’m familiar with is putting [ ] around the table name.
If I do my own manual find_by_sql and put “select * from [all wells
with apis]” it works fine.
Thanks for any suggestions.