SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 double quotation on column problem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ericz
Starting Member

USA
5 Posts

Posted - 12/03/2013 :  11:26:20  Show Profile  Reply with Quote
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

USA
36895 Posts

Posted - 12/03/2013 :  12:20:32  Show Profile  Visit tkizer's Homepage  Reply with Quote
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

USA
5 Posts

Posted - 12/03/2013 :  12:24:14  Show Profile  Reply with Quote
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/


Edited by - ericz on 12/03/2013 12:36:33
Go to Top of Page

tkizer
Almighty SQL Goddess

USA
36895 Posts

Posted - 12/03/2013 :  12:50:14  Show Profile  Visit tkizer's Homepage  Reply with Quote
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

United Kingdom
22403 Posts

Posted - 12/03/2013 :  13:00:16  Show Profile  Reply with Quote
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

USA
5 Posts

Posted - 12/03/2013 :  17:24:56  Show Profile  Reply with Quote
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.

Edited by - ericz on 12/03/2013 17:25:26
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000