We help IT Professionals succeed at work.

How to escape alias names for Oracle query

brgdotnet
brgdotnet asked
on
249 Views
Last Modified: 2017-04-06
I have some inline sql that will be run against sql server and Oracle. If it were strictly sql server I could surround my alias names with square brackets and the query will work against sql server. However it will not work against Oracle. So in order to make the query work against Oracle as well, I need to
surround my alias names with double quotes. So the below works against sql server, but still does not work against Oracle. So can someone suggest an alternate way to escape my alias names with double quotes, because the below does not work when i run it against Oracle.


const string mySql = "SELECT bt.UNIQUE_ID AS \"Client Unique Id\" FROM tbl_Cust_Table bt"

SqlCommand theCommand = new SqlCommand();
theCommand.CommandText = mySql
var parameter = theCommand.CreateParameter();
parameter.ParameterName = "@0";
parameter.DbType = DbType.Stringl
parameter.Value = inValue;
theCommand.Parameters.Add(parameter)
Comment
Watch Question

Senior Developer
CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION