Why do I get an error saying "DECLARE CURSOR is not supported." when connecting to my Azure Synapse Serverless SQL Pool
12 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2022 年 5 月 2 日
回答済み: MathWorks Support Team
2022 年 7 月 7 日
We are trying to access data from an Azure DataLake using the MS SQL ODBC driver in MATLAB R2020a. This works properly with other Database client applications, e.g. DBeaver or from pyodbc, but I haven't found yet how to do this in MATLAB.
We have configured a User DSN (name is DataLakeTest) and we can connect with:
>> conn = database('DataLakeTest', '', '');
But any query gives the following error:
>> Q = 'SELECT * FROM database.table';
>> data = select(conn, Q)
Error using database.odbc.connection/select (line 214)
ODBC Driver Error: ODBC Driver Error: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]DECLARE CURSOR is not
supported.
採用された回答
MathWorks Support Team
2022 年 5 月 2 日
The following command should resolve the issue you are experiencing with your database:
>> T = fetch(conn,'SET NOCOUNT ON; SELECT * FROM <tablename>')
NOCOUNT is SQL Server specific command.
SET NOCOUNT ON stops the message that shows the count of the number of rows affected by a Transact-SQL statement or stored procedure from being returned as part of the result set.
The recommended workaround is to SET NOCOUNT ON before executing a SELECT query.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Database Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!