When using Tools -> Export Data and using a SELECT statement to specify what data is to be exported, the tool should ignore any SQL comments preceding the actual SQL to be run. It seems like the very first thing provided in the SQL editor panel for the SELECT statement must be "select". We do a fair amount of exporting by SELECT and have a collection of saved SQL files for different exports. I like to have comments at the top of each of these SQL files documenting options, etc., to be used for each but I can't just copy and paste the entire SQL (with leading comments into the SQL editor).
It seems like it would make sense if the tool was smart enough to skip over any leading comments to determine whether what I have placed there is in fact a SELECT statement.
The Export Tool does a condition test on the query to make sure it starts with "SELECT" or "WITH".
The Export Tool will ignore Client Side comments, but not Server Side comments. Server Side comments are configurable in File->Options->Scripts->[DATABASE].
I don't see any reason why we should be sending server side comments in this scenario, so I've removed server side comments from the condition checking.
ExportThread : Line 264
ExportDialog : Line 1200
Verified in ADS v15.0.0-rc-34 and this fix will be in the latest ADS v15.0 release due next week (Sep 16)
Verified in ADS v15.0.0-rc-34 and this fix will be in the latest ADS v15.0 release due next week (Sep 16)
@Ron, we found one reason to send server side comments. Oracle Hints. e.g. select /*+ FULL(s) FULL(c) */
Can you give us some examples of your scripts so we can design a solution?
Can you also tell us what database vendor your scripts are with? and what comments types you are using? eg /**/, //, --.
@Ron, we found one reason to send server side comments. Oracle Hints. e.g. select /*+ FULL(s) FULL(c) */
Can you give us some examples of your scripts so we can design a solution?
Can you also tell us what database vendor your scripts are with? and what comments types you are using? eg /**/, //, --.
@Niels, sorry I am slow responding. All of our scripts where we are using this capability are for MS SQL Server, and the comments are /* */-style comments. There's nothing special in those comments, per se; they are primarily documentation for the script itself (what it's for, history, and any specific setting related to the export process to make sure we get stuff in the desired format). Here is an example from one of ours:
/*
Script: eia-annual-export.sql
Description: Export estimated inventory and consumption data from EIA survey database for
use in EIA's publication process. This script is typically run after the EIA PM completes
their imputation process and has QA'd the data.
Implementation History:
rs 2012-07: Initial version for FY2011
rs 2013-11: Updates based on prior year survey changes to the shape of the underlying view
*/
/* Configuration for export:
Export as [NEIC].[vehUserData]
Encoding: default
Platform: Windows style EOL (CR/LF)
Format: INSERT statements
Statement separator: GO
Object quoted identifier: square brackets [object]
Include table CREATE as first statement
Enable identity insert
*/
SELECT DISTINCT
dataYear,
frame AS frmName,
REPLACE(longFrame, '&', '&') AS frmNameLong,
frameRank AS frmRank,
REPLACE(userType, '&', '&') AS usrGroup,
shortUserType AS usrGroupShort,
userTypeRank AS usrGroupRank,
shortLocation AS vehLocation,
longLocation AS vehLocationLong,
locationRank AS vehLocationRank,
census AS vehCensusRegion,
weightClass AS vehWeightClass,
weightClassCode AS vehWeightClassCode,
weightClassOrder AS vehWeightClassRank,
shortVehicleType AS vehTypeCode,
CASE
WHEN CHARINDEX('^', vtCategory) > 0 THEN SUBSTRING(vtCategory, 1, CHARINDEX('^', vtCategory) - 1)
ELSE vtCategory
END AS vehCategory,
...
(rest of SQL snipped)
Does that help?
@Niels, sorry I am slow responding. All of our scripts where we are using this capability are for MS SQL Server, and the comments are /* */-style comments. There's nothing special in those comments, per se; they are primarily documentation for the script itself (what it's for, history, and any specific setting related to the export process to make sure we get stuff in the desired format). Here is an example from one of ours:
/*
Script: eia-annual-export.sql
Description: Export estimated inventory and consumption data from EIA survey database for
use in EIA's publication process. This script is typically run after the EIA PM completes
their imputation process and has QA'd the data.
Implementation History:
rs 2012-07: Initial version for FY2011
rs 2013-11: Updates based on prior year survey changes to the shape of the underlying view
*/
/* Configuration for export:
Export as [NEIC].[vehUserData]
Encoding: default
Platform: Windows style EOL (CR/LF)
Format: INSERT statements
Statement separator: GO
Object quoted identifier: square brackets [object]
Include table CREATE as first statement
Enable identity insert
*/
SELECT DISTINCT
dataYear,
frame AS frmName,
REPLACE(longFrame, '&', '&') AS frmNameLong,
frameRank AS frmRank,
REPLACE(userType, '&', '&') AS usrGroup,
shortUserType AS usrGroupShort,
userTypeRank AS usrGroupRank,
shortLocation AS vehLocation,
longLocation AS vehLocationLong,
locationRank AS vehLocationRank,
census AS vehCensusRegion,
weightClass AS vehWeightClass,
weightClassCode AS vehWeightClassCode,
weightClassOrder AS vehWeightClassRank,
shortVehicleType AS vehTypeCode,
CASE
WHEN CHARINDEX('^', vtCategory) > 0 THEN SUBSTRING(vtCategory, 1, CHARINDEX('^', vtCategory) - 1)
ELSE vtCategory
END AS vehCategory,
...
(rest of SQL snipped)
Does that help?
I made a fix, so that the original query is sent to the server, but the condition check for SELECT and WITH is done without the comments. This should resolve this issue, and still retain comments for Oracle Hints.
http://www.aquafold.com/download/v15.0.0/ads-15.0.9-18-patch.zip
I made a fix, so that the original query is sent to the server, but the condition check for SELECT and WITH is done without the comments. This should resolve this issue, and still retain comments for Oracle Hints.
http://www.aquafold.com/download/v15.0.0/ads-15.0.9-18-patch.zip
Issue #12471 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
Fixed Build 15.0.9-18 |
No time estimate |
The Export Tool does a condition test on the query to make sure it starts with "SELECT" or "WITH".
The Export Tool will ignore Client Side comments, but not Server Side comments. Server Side comments are configurable in File->Options->Scripts->[DATABASE].
I don't see any reason why we should be sending server side comments in this scenario, so I've removed server side comments from the condition checking.
ExportThread : Line 264
ExportDialog : Line 1200