Double Quotes in sql in uipath

Hi,

I have a query which looks like this: select col1,col2 "abc" from table;
Capture

I think it has got to do something with the double quotes for abc .
Any help would be appreciated.

Add another double quote around ““abc”” :slight_smile:

Kindly have a view on this thread

Cheers @hss

@TimK i added, it is giving me an error like: Compiler error : String constants must end with double quote.. not sure where am making the mistake

"select /*parallel(a,16)*/ col1 ""abc"",col2 ""def"" from table where 1=1 and col1='Y' and col2 In ('ww','gg') order by col1,col2"

@Palaniyappan i tried… the assigning to string itself gives me that same error… So am guessing am writing the string incorrectly .

Hi, stupid question: can you write it with single quotes? (select col1,col2 ‘abc’ from table)

what kind of database are you using? is the abc like an alias for the column?

You can use Write Line to look at your Query in the output panel.

Afterwards you can copy the Query and test it in the DB IDE

@bcorrea db is oracle, abc yes is column alias

I have tried the same string in mine and it works - try assign the SQL to a string variable first then use that variable and see if that works for you.

“select /parallel(a,16)/ col1 ““abc””,col2 ““def”” from table where 1=1 and col1=‘Y’ and col2 In (‘ww’,‘gg’) order by col1,col2”

so i think in your case you dont need the quotes and also you can do like this:

SELECT p.product_id, p.product_name, categories.category_name
FROM products p

where p is the alias for the products table…

Double quotes or Square Brackets are required if column alias has a space so depends on that too…

yes, that is why i said in his case he didnt need…

How amazing that in almost 4 years noone replied properly to this question. Probably even the staff members don’t realize what’s going on.

If you have a long query that takes several lines inside the “expression editor” (or inside the “Edit query…” button / “Edit SQL” dialog – which, by the way, is double confusing: 1 - because the button has a different name than the dialog it opens and 2 - because the “expression editor” dialog and the “Expression whatever” dialog look quite similar and the difference amongs them is not clear and it’s probably nothing else than adding the “variables” for the parameters for the parametrized query -again double confusing because the tutorial in How To Pass Dynamic Data To SQL Query From UiPath? - News / Knowledge Base - UiPath Community Forum talks about two methods, “passing variables” and “passing parameters”, but then the “variables” nomenclature are used in the dialog of passing the actual PARAMETERS) that takes MORE THAN ONE LINE, then simple duplicating the double quotes for escaping the column name aliases that have an space in the middle will simple not work.

You need to split each different line, surround them in double quotes and join them together, this style:

"SELECT E.MYDATE, "“MY DATE 1"”, F.MYDATE ““MY DATE 2"”, F.PATH " &
" FROM SENTS1 E " &
" JOIN SENT2.F ON E.ID=F.ID " &
" WHERE E.COD_FILE In " &
" (SELECT CV.VAL " &
" FFROM CMPS_VALUE CV) " &
" AND E.ID_EXP = @idExp

Such a hassle.