Link to home
Start Free TrialLog in
Avatar of billelev
billelevFlag for United States of America

asked on

when I post a query into PgAdmin I get an error, but when I type it I do not. Why?

I have a query

ALTER TABLE tbl_trades_all RENAME COLUMN "StlDate" TO stldate;

that I paste into the query editor.  When I paste it, I get the following error:

ERROR:  syntax error at or near "ALTER TABLE tbl_trades_all RENAME COLUMN "
LINE 1: ALTER TABLE tbl_trades_all RENAME COLUMN "StlDate" TO stldat...
        ^

********** Error **********

ERROR: syntax error at or near "ALTER TABLE tbl_trades_all RENAME COLUMN "
SQL state: 42601
Character: 1

However, if I type the query, it works.  Does anyone know why?
ASKER CERTIFIED SOLUTION
Avatar of lcohan
lcohan
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of billelev

ASKER

I'm using Excel/Notepad++

What would a 100% ANSI text file be?  I just tried copying from Windows Notepad and that did not work.
Try ope a New Test file, past your string in there, Save As and change the type/encoding to ANSI.
Reopen that file, copy the string from it and paste in PGADMIN must work.
The method I found that worked was to paste the text into my google search bar first...Nice!
Similar thing and as I mentioned the failure in PGADMIN is due to the UNICODE caracters in your clipbord and the fix/workaround is to convert them to text by saving them to a text file or as you found in google serach bar or like in a Outlook Subject line on a new email. All these will do same thing - convert your unicode into ansi or utf8 to match PGADMIN encoding.