Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 double quotation on column problem

Author  Topic 

ericz
Starting Member

5 Posts

Posted - 2013-12-03 : 11:26:20
Dear all,
I have a view. When I select data, I have to use double quotation on selected column name, for instance:
select "assy_no" from myView;
if I try
select assy_no from myView
I will get error: ORA-00904: "ASSY_NO": invalid identifier

When I query on the tables used by the view, double quotation is not required.
Why the column name on my view requires double quotation?
Please help.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2013-12-03 : 12:20:32
Looks like you are using Oracle. SQLTeam.com is for Microsoft SQL Server. You'll want to post your question on a site that specializes in Oracle.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

ericz
Starting Member

5 Posts

Posted - 2013-12-03 : 12:24:14
I am using MS SQL and Oracle. On Oracle, I have a dblink to a DB on MS SQL Server 2008 R2. The query is to a view on MS SQL DB from plsql on dos.

If I query directly from MS SQL studio, no quotation needed. Via sqlplus with dblink on Oracle, it requires double quotation.

Thanks for your reply.

quote:
Originally posted by tkizer

Looks like you are using Oracle. SQLTeam.com is for Microsoft SQL Server. You'll want to post your question on a site that specializes in Oracle.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2013-12-03 : 12:50:14
Since it works in SSMS, there isn't anything that we can help with here. I suspect the database driver doesn't like the underscore when querying the view. But it really shouldn't matter. You could try updating your database driver to the latest and greatest, but outside of that you are stuck double quoting these. There isn't anything we can do on the SQL Server side to fix it, since it's fine on the SQL Server side.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2013-12-03 : 13:00:16
Long shot:

Can you put square brackets around the column name? That will work in MS SQL too, so at least the same code would work on either.

select [ASSY_NO] from myView

although maybe that would be no help anyway?
Go to Top of Page

ericz
Starting Member

5 Posts

Posted - 2013-12-03 : 17:24:56
It seems it is the way with the double quotation. A workaround is to create a view at Oracle to wrap all the quotation from the dblink.

Thanks for all of your helps.
Go to Top of Page
   

- Advertisement -