SQL Server Distributed queries with Teradata - sql-server
I am trying to get distributed queries to run on SQL Server 2012 with a linked server to Teradata.
Connection works fine and query returns quickly if I pass the where clause into the remote SQL using openquery e.g.
select *
from openquery(td, 'select * from lib.purchases where z_PO = ''123456''')
However the below does not run as expected: SQL Server loads the entire table and performs a local filter:
select *
from openquery(td, 'select * from lib.purchases') where z_PO = '123456'
The source table has 100M records.
Obviously index play no role here as query runs just fine on TD side.
What I have tried:
sp_configure 'Ad Hoc Distributed Queries', 1
set Collation Compatible" = True on the linked server properties
Instead of 2, set Collation Name = Latin1_BIN to match (closely?) TD character set (ASCII).
Not sure collation is the issue as I get same result when filtering on numeric fields.
Somehow the so-called query optimizer in SQL Server does not push simple filtering down to the remote server.
Is this the ODBC driver's fault (using 16.10) - a setting, a bug? SQL Server 2012 (v11.0.6248.0) setting I am missing (or path req'd)?
Below is the OLEDB for ODBC properties that I capture in SQL Profiler:
<ProviderInformation>
<Provider>MSDASQL</Provider>
<LinkedServer>td</LinkedServer>
<ProviderCapabilitiesAndSettings>
<Ansi92EntrySupport>0</Ansi92EntrySupport>
<ODBCCoreSupport>1</ODBCCoreSupport>
<ODBCMinimumSupport>1</ODBCMinimumSupport>
<SimpleGrammarSupport>0</SimpleGrammarSupport>
<AnsiLikeSupport>0</AnsiLikeSupport>
<SQLLikeSupport>1</SQLLikeSupport>
<DateLiteralsSupport>0</DateLiteralsSupport>
<GroupBySupport>0</GroupBySupport>
<InnerJoinSupport>0</InnerJoinSupport>
<SubqueriesSupport>0</SubqueriesSupport>
<SimpleUpdatesSupport>0</SimpleUpdatesSupport>
<HistogramsSupport>0</HistogramsSupport>
<ColumnLevelCollationSupport>0</ColumnLevelCollationSupport>
<ConnectionSharingSupport>0</ConnectionSharingSupport>
<MultipleActiveRowsetsSupport>0</MultipleActiveRowsetsSupport>
<MultipleResultsSupport>1</MultipleResultsSupport>
<AllowLimitingRowsReturned>1</AllowLimitingRowsReturned>
<NullConcatenationYieldsNull>0</NullConcatenationYieldsNull>
<StructuredStorageAccessToLargeObjects>1</StructuredStorageAccessToLargeObjects>
<MultipleConcurrentLargeObjectSupport>0</MultipleConcurrentLargeObjectSupport>
<DynamicParametersSupport>1</DynamicParametersSupport>
<NestedQueriesSupport>1</NestedQueriesSupport>
<IndicesAvailableAsAccessPath>0</IndicesAvailableAsAccessPath>
<AllowDataAccessByReference>1</AllowDataAccessByReference>
<RowsetChangesAreVisible>0</RowsetChangesAreVisible>
<RowsetSupportsAppendOnly>0</RowsetSupportsAppendOnly>
<UseLevelZeroOledbInterfacesOnly>0</UseLevelZeroOledbInterfacesOnly>
<RowsetUpdatability>1</RowsetUpdatability>
<AsynchronousRowsetProcessingSupport>0</AsynchronousRowsetProcessingSupport>
<DataSourceUnicodeLocaleId>0</DataSourceUnicodeLocaleId>
<DataSourceUnicodeComparisonStyle>0</DataSourceUnicodeComparisonStyle>
<DataSourceCollationComparisonFlags>0</DataSourceCollationComparisonFlags>
<DataSourceCharacterset></DataSourceCharacterset>
<DataSourceSortOrder></DataSourceSortOrder>
<DataSourceNullCollationOrder>4</DataSourceNullCollationOrder>
<CurrentDbCollationSameAsDefaultRemoteDbCollation>0</CurrentDbCollationSameAsDefaultRemoteDbCollation>
<UnicodeLiteralSupport>0</UnicodeLiteralSupport>
<UnicodeLiteralPrefix></UnicodeLiteralPrefix>
<UnicodeLiteralSuffix></UnicodeLiteralSuffix>
<DateLiteralPrefix></DateLiteralPrefix>
<DateLiteralSuffix></DateLiteralSuffix>
<ObjectNameConstructionFlags>54</ObjectNameConstructionFlags>
<SchemaSeparator>.</SchemaSeparator>
<CatalogSeparator>.</CatalogSeparator>
<QuoteSeparator>"</QuoteSeparator>
<BitRemoting>0</BitRemoting>
<UnicodeLiterals>0</UnicodeLiterals>
<ProviderOledbVersion>131072</ProviderOledbVersion>
<HalloweenProtectionNeeded>1</HalloweenProtectionNeeded>
<RowsetUsableAcrossThreads>0</RowsetUsableAcrossThreads>
<ObjectNameIsSinglePart>0</ObjectNameIsSinglePart>
<Cardinality>-1</Cardinality>
<BookmarkSupport>0</BookmarkSupport>
<BookmarksReusable>0</BookmarksReusable>
<TableFlags>0</TableFlags>
</ProviderCapabilitiesAndSettings>
and here the details of the column in the filter:
DBCOLUMNINFO>
<pwszName>z_PO</pwszName>
<pTypeInfo>0x0000000000000000</pTypeInfo>
<iOrdinal>53</iOrdinal>
<dwFlags>120</dwFlags>
<ulColumnSize>10</ulColumnSize>
<wType>129</wType>
<bPrecision>255</bPrecision>
<bScale>255</bScale>
<DBID>
<eKind>DBKIND_NAME</eKind>
<uName.pwszName>z_PO</uName.pwszName>
</DBID>
</DBCOLUMNINFO>
As a FYI, the context is wrapping the openquery, joined with local data, into a SQL Server view, which is the only thing users would see - from there, they can apply any filter (WHERE) within PowerQuery (XL) or PowerBI. A way to circumvent the lack of DirectQuery support through ODBC.
Related
R : problem with the dplyr::tbl() function due to restricted permission
I work with large databases that needs to be stored into a server. So, to work with them on Rstudio I have to open a connection to my Microsoft SQL Server with the dbConnect function : conn <- dbConnect(odbc(),"myconnection",uid="***",pwd="***",schema="dbo",access="readonly") and in order to use dplyr, I have to create data references with the tbl function : data <- tbl(conn, "data") But one of the online dataframe contains a columns that I can't read because I dont have the access, but I can read everything else. The SQL query behind the tbl() function is : SELECT * FROM data and this is my problem. Even when I try to select a specific column it doesn't work (see below), so I can't create my references and I can't work. select(tbl(conn, "data"), "columnX") = SELECT columnX FROM data I think this is the tbl() function and the call of "SELECT *" that blocks me. Do you know what can I do ? Is there smilar functions that could resolve my problem ?
If you know the columns that you have access to, then one option is to bypass the default access SELECT * FROM ... with your own SQL query. A remote table is defined by two components: The database conneciton The query to the database When you connect with the default approach tbl(conn, 'data') then it defaults to a query SELECT * FROM data. But here is another approach: custom_query = 'SELECT columnX FROM data' remote_table = tbl(conn, dbplyr::sql(customer_query))
R: Best Practices - dplyr and odbc multi table actions (retrieved from SQL)
Say you have your tables stores in an SQL server DB, and you want to perform multi table actions, i.e. join several tables from that same database. Following code can interact and receive data from SQL server: library(dplyr) library(odbc) con <- dbConnect(odbc::odbc(), .connection_string = "Driver={SQL Server};Server=.;Database=My_DB;") Table1 <- tbl(con, "Table1") Table1 # View glimpse of Table1 Table2 <- tbl(con, "Table2") Table2 # View glimpse of Table2 Table3 <- tbl(con, "Table3") However, with a few results retrieved with the same connection, eventually following error occurs: Error: [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt My current googling skills have taking me to the answer that the backend does not support multiple active result sets (MARS) - I guess more than 2 active result sets is the maximum? (backend is DBI and odbc) So, my question is: what is best practice if I want to collect data from several tables from an SQL DB? Open a connection for each table? Actively close the connection and open it again for the next table? Does the backend support MARS to be parsed to the connection string?
To make a connection that can hold multiple result sets, I've had luck with following connection code: con <- DBI::dbConnect(odbc::odbc(), Driver = "SQL Server Native Client 11.0", Server = "my_host", UID = rstudioapi::askForPassword("Database UID"), PWD = rstudioapi::askForPassword("Database PWD"), Port = 1433, MultipleActiveResultSets = "True", Database = my_db) On top of that, I found that the new pool-package can do the job: pool <- dbPool(odbc::odbc(), Driver = "SQL Server Native Client 11.0", Server = "my_host", UID = rstudioapi::askForPassword("Database UID"), PWD = rstudioapi::askForPassword("Database PWD"), Port = 1433, MultipleActiveResultSets = "True", Database = my_db) It is quicker and more stable than the DBI connection, however, one minor drawback is that the database doesn't pop up in the connection tab for easy reference. For both methods, remember to close the connection/pool when done. For the DBI-method its: dbDisconnect(con) Whereas the pool-method is closed by calling: poolClose(pool)
How to resolve Application timeout issue due to SQL Query in 'Killed/ROLLBACK' Scenario
I've an application which has a database in SQL server 2012 and the application use entity framework to communicate with database. In the application, there is a functionality to update a record in a table based on a WHERE condition and the Primary Key field is the one used in the WHERE condition. So the update happens only to a single record (there is no loop or anything just an update to a single record). This is the background. Here is the issue now I'm facing - I'm getting a timeout error message from the application when I invoke the functionality to update a record in the table (as mentioned above). I checked the query execution in the SQL server using 'Activity Monitor' and under the 'Processes' tab I could see that the Command of this query comes to 'KILLED/ROLLBACK' after some 'Wait Types' (like LOGBUFFER, pageiolatch_XX, etc...) I tried to execute the update query directly in SQL server and that also not responding. So it's clear the issues is with the SQL server and it takes too much time to execute the update query. But the execution plan looks good and the PK field is used as the where condition. Is it something related with disk latency? Note: This issues is not consistent, sometimes it works. Here is the file stat. How can I interpret or reach a conclusion from these data... My DB DbId FileId TimeStamp NumberReads BytesRead IoStallReadMS NumberWrites BytesWritten IoStallWriteMS IoStallMS BytesOnDisk FileHandle 2 1 -1152466625 21199845 1351872315392 2528572322 21869447 1424883785728 10201419039 12729991361 28266332160 0x0000000000000C64 2 2 -1152466625 1063 45187072 87119 1013000 61628433920 178901888 178989007 6945505280 0x0000000000000CC4 TempDB DbId FileId TimeStamp NumberReads BytesRead IoStallReadMS NumberWrites BytesWritten IoStallWriteMS IoStallMS BytesOnDisk FileHandle 18 1 -1152466625 390905 27728437248 52640514 196501 6927843328 817347538 869988052 58378551296 0x0000000000001F3C 18 2 -1152466625 24840 1596173312 645024 56563 3335298048 2590871 3235895 938344448 0x00000000000012BC
CRM Auto Pre-filter doesn't pass a query
I've created a simple SSRS report using Visual Studio 2012, I'm using CRMAF_ prefix to use CRM's auto filtering, and achieve a context-based report. I'm using two datasets to achieve this; dsFiltered for the filtered data, and dsApprovalSummary for my report. This is the query dsFiltered uses : declare #sql as nVarchar(max) set #sql = 'SELECT vrp_investdocumentid FROM (' + #CRM_Filteredvrp_investdocument + ') as CRMAF_vrp_investdocument' exec(#sql) This is the query dsApprovalSummary uses : select doc.vrp_name as 'Yatırım Dosyası', act.vrp_actioncode as 'Aksiyon Kodu', cfg.vrp_description as 'Aksiyon Açıklaması', act.OwnerIdName as 'Aksiyon Sorumlusu', act.ModifiedOn as 'Son Değiştirme Tarihi' from vrp_action act inner join vrp_investdocument as doc on act.RegardingObjectId=doc.vrp_investdocumentId inner join vrp_actionconfig as cfg on act.vrp_actioncode = cfg.vrp_actioncode where cfg.vrp_reporttask=1 and act.RegardingObjectId = #documentId order by act.ModifiedOn The parameters are : #CRM_Filteredvrp_investdocument - The parameter CRM should have been populated with a query, defaults to null #CRM_vrp_investdocumentId - Comes from dsFiltered (CRMAF_vrp_investdocument.vrp_investdocumentid); allows null. The report works perfectly on the development server. However, when i deploy the report into the production server, it does not ask me to select a filter, or does not have a default filter; tries to run directly and then gives an rsProcessingAborted. I've checked the logs, and saw it said SYNTAX ERROR NEAR )-. This is from the report server logs : processing!ReportServer_0-20!13ec!11/11/2014-13:45:04:: w WARN: Data source 'srcApprovalSummary': Report processing has been aborted. processing!ReportServer_0-20!13ec!11/11/2014-13:45:04:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: , Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: An error has occurred during report processing. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Query execution failed for dataset 'dsFiltered'. ---> System.Data.SqlClient.SqlException: Incorrect syntax near ')' UPDATE : On the development server, we have everything installed on the same machine; CRM Frontend, Services, SQL Server, Report Server etc. But on the production environment, each one of these servers are different machines. Could this be the source of error? UPDATE 2 : Running the profiler gave me that #CRM_Filteredvrp_investdocument comes in NULL. See the query below from the profiler : exec sp_executesql N'declare #sql as nVarchar(max) set #sql = ''SELECT vrp_investdocumentid FROM ('' + #CRM_Filteredvrp_investdocument + '') as CRMAF_vrp_investdocument'' exec(#sql)',N'#CRM_Filteredvrp_investdocument nvarchar(4000)',#CRM_Filteredvrp_investdocument=NULL
It turns out to be a collation problem, i've been trying to use a custom data source with this connection string : Data Source=myprodsqlserver; Initial Catalog=myorganization_MSCRM; I've rewritten it lowercase, and replaced the data source with localhost the problem is magically gone. data source=localhost; initial catalog=myorganization_MSCRM;
In the report editor, try rebuilding the datasource used by each of your datasets using the connection string builder (don't type it manually). Build them so they point to your Prod CRM database and then test the report completely in the report editor. This will determine if the problem is lies with the report or CRM.
Oracle and SQL Server reserved keywords
I need a list of Oracle Database 10g and SQL Server 2008 reserved key words. My application performs DDL statements, thus I need to validate the entered table-, column names, etc. against the reserved words. I know that I can copy and paste the words from the websites: Oracle 10g and SQL Server 2008 But I would prefer a SQL command so that the keywords can be loaded dynamically. For oracle there exists the command: SELECT KEYWORD FROM V$RESERVED_WORDS ORDER BY KEYWORD ASC ; It's just strange that this command retrieves 1146 words, but the online list just contains about 456! Are there reasons for? Is there also a command available for SQL Server databases?
By this you can get all keywords for MS SQL Server - SELECT t.keyword FROM ( VALUES ('ABSOLUTE'),('ACTION'),('ADA'),('ADD'), ('ADMIN'),('AFTER'),('AGGREGATE'),('ALIAS'), ('ALL'),('ALLOCATE'),('ALTER'),('AND'), ('ANY'),('ARE'),('ARRAY'),('AS'), ('ASC'),('ASENSITIVE'),('ASSERTION'),('ASYMMETRIC'), ('AT'),('ATOMIC'),('AUTHORIZATION'),('AVG'), ('BACKUP'),('BEFORE'),('BEGIN'),('BETWEEN'), ('BINARY'),('BIT'),('BIT_LENGTH'),('BLOB'), ('BOOLEAN'),('BOTH'),('BREADTH'),('BREAK'), ('BROWSE'),('BULK'),('BY'),('CALL'), ('CALLED'),('CARDINALITY'),('CASCADE'),('CASCADED'), ('CASE'),('CAST'),('CATALOG'),('CHAR'), ('CHAR_LENGTH'),('CHARACTER'),('CHARACTER_LENGTH'), ('CHECK'),('CHECKPOINT'),('CLASS'),('CLOB'),('CLOSE'), ('CLUSTERED'),('COALESCE'),('COLLATE'),('COLLATION'),('COLLECT'),('COLUMN'),('COMMIT'), ('COMPLETION'),('COMPUTE'),('CONDITION'),('CONNECT'), ('CONNECTION'),('CONSTRAINT'),('CONSTRAINTS'),('CONSTRUCTOR'), ('CONTAINS'),('CONTAINSTABLE'),('CONTINUE'),('CONVERT'),('CORR'), ('CORRESPONDING'),('COUNT'),('COVAR_POP'),('COVAR_SAMP'),('CREATE'), ('CROSS'),('CUBE'),('CUME_DIST'),('CURRENT'),('CURRENT_CATALOG'), ('CURRENT_DATE'),('CURRENT_DEFAULT_TRANSFORM_GROUP'),('CURRENT_PATH'),('CURRENT_ROLE'),('CURRENT_SCHEMA'), ('CURRENT_TIME'),('CURRENT_TIMESTAMP'),('CURRENT_TRANSFORM_GROUP_FOR_TYPE'),('CURRENT_USER'),('CURSOR'),('CYCLE'), ('DATA'),('DATABASE'),('DATE'),('DAY'),('DBCC'),('DEALLOCATE'),('DEC'),('DECIMAL'),('DECLARE'), ('DEFAULT'),('DEFERRABLE'),('DEFERRED'),('DELETE'),('DENY'),('DEPTH'),('DEREF'),('DESC'),('DESCRIBE'), ('DESCRIPTOR'),('DESTROY'),('DESTRUCTOR'),('DETERMINISTIC'),('DIAGNOSTICS'),('DICTIONARY'),('DISCONNECT'),('DISK'), ('DISTINCT'),('DISTRIBUTED'),('DOMAIN'),('DOUBLE'),('DROP'),('DUMP'),('DYNAMIC'),('EACH'),('ELEMENT'), ('ELSE'),('END'),('END-EXEC'),('EQUALS'),('ERRLVL'),('ESCAPE'),('EVERY'),('EXCEPT'), ('EXCEPTION'),('EXEC'),('EXECUTE'),('EXISTS'),('EXIT'),('EXTERNAL'), ('EXTRACT'),('FALSE'),('FETCH'),('FILE'),('FILLFACTOR'),('FILTER'),('FIRST'),('FLOAT'),('FOR'), ('FOREIGN'),('FORTRAN'),('FOUND'),('FREE'),('FREETEXT'),('FREETEXTTABLE'),('FROM'),('FULL'),('FULLTEXTTABLE'),('FUNCTION'), ('FUSION'),('GENERAL'),('GET'),('GLOBAL'),('GO'),('GOTO'),('GRANT'),('GROUP'),('GROUPING'),('HAVING'), ('HOLD'),('HOLDLOCK'),('HOST'),('HOUR'),('IDENTITY'),('IDENTITY_INSERT'),('IDENTITYCOL'),('IF'), ('IGNORE'),('IMMEDIATE'),('IN'),('INCLUDE'),('INDEX'),('INDICATOR'),('INITIALIZE'),('INITIALLY'),('INNER'),('INOUT'), ('INPUT'),('INSENSITIVE'),('INSERT'),('INT'),('INTEGER'),('INTERSECT'),('INTERSECTION'), ('INTERVAL'),('INTO'),('IS'),('ISOLATION'),('ITERATE'),('JOIN'),('KEY'),('KILL'),('LANGUAGE'), ('LARGE'),('LAST'),('LATERAL'),('LEADING'),('LEFT'),('LESS'),('LEVEL'),('LIKE'),('LIKE_REGEX'),('LIMIT'),('LINENO'),('LN'), ('LOAD'),('LOCAL'),('LOCALTIME'),('LOCALTIMESTAMP'),('LOCATOR'),('LOWER'), ('MAP'),('MATCH'),('MAX'),('MEMBER'),('MERGE'),('METHOD'),('MIN'),('MINUTE'),('MOD'),('MODIFIES'),('MODIFY'),('MODULE'), ('MONTH'),('MULTISET'),('NAMES'),('NATIONAL'),('NATURAL'),('NCHAR'),('NCLOB'),('NEW'),('NEXT'),('NO'),('NOCHECK'), ('NONCLUSTERED'),('NONE'),('NORMALIZE'),('NOT'),('NULL'),('NULLIF'), ('NUMERIC'),('OBJECT'),('OCCURRENCES_REGEX'),('OCTET_LENGTH'),('OF'),('OFF'),('OFFSETS'),('OLD'),('ON'),('ONLY'),('OPEN'), ('OPENDATASOURCE'),('OPENQUERY'),('OPENROWSET'),('OPENXML'),('OPERATION'),('OPTION'),('OR'), ('ORDER'),('ORDINALITY'),('OUT'),('OUTER'),('OUTPUT'), ('OVER'),('OVERLAPS'),('OVERLAY'),('PAD'),('PARAMETER'), ('PARAMETERS'),('PARTIAL'),('PARTITION'),('PASCAL'),('PATH'), ('PERCENT'),('PERCENT_RANK'),('PERCENTILE_CONT'),('PERCENTILE_DISC'),('PIVOT'),('PLAN'),('POSITION'), ('POSITION_REGEX'),('POSTFIX'),('PRECISION'),('PREFIX'),('PREORDER'),('PREPARE'),('PRESERVE'), ('PRIMARY'),('PRINT'),('PRIOR'), ('PRIVILEGES'),('PROC'),('PROCEDURE'),('PUBLIC'),('RAISERROR'), ('RANGE'),('READ'),('READS'),('READTEXT'), ('REAL'),('RECONFIGURE'),('RECURSIVE'),('REF'),('REFERENCES'),('REFERENCING'),('REGR_AVGX'),('REGR_AVGY'),('REGR_COUNT'), ('REGR_INTERCEPT'),('REGR_R2'),('REGR_SLOPE'),('REGR_SXX'),('REGR_SXY'),('REGR_SYY'),('RELATIVE'), ('RELEASE'),('REPLICATION'),('RESTORE'),('RESTRICT'), ('RESULT'),('RETURN'),('RETURNS'),('REVERT'), ('REVOKE'),('RIGHT'),('ROLE'),('ROLLBACK'),('ROLLUP'),('ROUTINE'), ('ROW'),('ROWCOUNT'),('ROWGUIDCOL'),('ROWS'),('RULE'),('SAVE'),('SAVEPOINT'),('SCHEMA'),('SCOPE'), ('SCROLL'),('SEARCH'),('SECOND'),('SECTION'),('SECURITYAUDIT'),('SELECT'),('SENSITIVE'), ('SEQUENCE'),('SESSION'),('SESSION_USER'), ('SET'),('SETS'),('SETUSER'),('SHUTDOWN'),('SIMILAR'),('SIZE'),('SMALLINT'),('SOME'), ('SPACE'),('SPECIFIC'),('SPECIFICTYPE'),('SQL'),('SQLCA'),('SQLCODE'),('SQLERROR'), ('SQLEXCEPTION'),('SQLSTATE'),('SQLWARNING'),('START'),('STATE'),('STATEMENT'), ('STATIC'),('STATISTICS'),('STDDEV_POP'),('STDDEV_SAMP'),('STRUCTURE'),('SUBMULTISET'), ('SUBSTRING'),('SUBSTRING_REGEX'),('SUM'),('SYMMETRIC'),('SYSTEM'),('SYSTEM_USER'), ('TABLE'),('TABLESAMPLE'),('TEMPORARY'),('TERMINATE'),('TEXTSIZE'),('THAN'),('THEN'),('TIME'), ('TIMESTAMP'),('TIMEZONE_HOUR'),('TIMEZONE_MINUTE'),('TO'),('TOP'), ('TRAILING'),('TRAN'),('TRANSACTION'),('TRANSLATE'),('TRANSLATE_REGEX'),('TRANSLATION'), ('TREAT'),('TRIGGER'),('TRIM'),('TRUE'),('TRUNCATE'),('TSEQUAL'), ('UESCAPE'),('UNDER'),('UNION'),('UNIQUE'),('UNKNOWN'),('UNNEST'),('UNPIVOT'),('UPDATE'),('UPDATETEXT'), ('UPPER'),('USAGE'),('USE'),('USER'),('USING'),('VALUE'), ('VALUES'),('VAR_POP'),('VAR_SAMP'),('VARCHAR'),('VARIABLE'), ('VARYING'),('VIEW'),('WAITFOR'),('WHEN'),('WHENEVER'), ('WHERE'),('WHILE'),('WIDTH_BUCKET'),('WINDOW'),('WITH'),('WITHIN'),('WITHOUT'),('WORK'), ('WRITE'),('WRITETEXT'),('XMLAGG'),('XMLATTRIBUTES'), ('XMLBINARY'),('XMLCAST'),('XMLCOMMENT'),('XMLCONCAT'),('XMLDOCUMENT'), ('XMLELEMENT'),('XMLEXISTS'),('XMLFOREST'),('XMLITERATE'),('XMLNAMESPACES'), ('XMLPARSE'),('XMLPI'),('XMLQUERY'),('XMLSERIALIZE'),('XMLTABLE'), ('XMLTEXT'),('XMLVALIDATE'),('YEAR'),('ZONE') ) AS t(keyword)
I can't vouch for its credibility nor completeness, but I have appreciated for years Pete Freitag's 'SQL Reserved Words Checker' as a quick and handy reference (and keeping in mind cross-compatibility issues): http://www.petefreitag.com/tools/sql_reserved_words_checker/