Avatar of brgdotnet
brgdotnet
Flag for United States of America asked on

How to escape alias names for Oracle query

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)
C#

Avatar of undefined
Last Comment
Dmitry G

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Dmitry G

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.
fblack61