For the love of god and all that is holy, how on earth do you ESCAPE the ODBC Escape characters {} (curly braces) within an Execute SQL Task in a DTS package ??!??!
I'm using PostgreSQL ANSI ODBC driver 9.03.02.10 connecting to redshift to perform an unload. The caveat is that my query has a regex in it wrapped in an unload. I've created the example below to display what is happening.
Unloads in redshift have to be wrapped in single quote ( ' ), of course escaping any quotes that need to go along for the ride. When it gets to the { it thinks I want to do an ODBC escape to do something like this http://msdn.microsoft.com/en-us/library/ms711838(v=vs.85).aspx but I don't want it to. I've tried setting { escape '#' }, I've tried all the combos of escapes I can. Is there a way to escape this, or disable ODBC Escape Sequences in the package or anything of that nature?
This query works as it should(within the Exec SQL task) when it is not wrapped in the single quotes. For example, running the script without it being wrapped in the UNLOAD(' ') command executes successfully.
QUERY:
UNLOAD(' SELECT * FROM testing_regex WHERE 1=1 AND somestring ~* \'[a-z]{7}$\' ') TO 's3://path' CREDENTIALS 'aws_access_key_id=xxx;aws_secret_access_key=xxx' DELIMITER '|' ALLOWOVERWRITE ADDQUOTES