I am testing Synapse. I tried this query
SELECT
TOP 100 *
FROM
OPENROWSET(
BULK '<path to the parquet file>',
FORMAT='PARQUET'
) AS [result]
But I get the following error. How can I solve it?
Parse error at line: 4, column: 5: Incorrect syntax near 'OPENROWSET'.
That type of query would work in the serverless SQL pool, as per the documentation on OPENROWSET. It would not work in a dedicated SQL pool.
If you are in Synapse Studio, try changing the Connect to option to Built-in, which is the serverless engine. Optionally create a database to store objects like external data sources, external tables and views in:
Another easy way to generate a working OPENROWSET statement would be via Synapse Studio > Data hub (the little cylinder on the right), Linked > double-click your datalake to navigate to the parquet file you want to query > right-click it > SELECT TOP 100 ...
Related
I have an instance running SQL Server 2014 Express Edition (64-bit Build 19044). I have the same machine running a MySQL server (innodb_version: 5.7.33, protocol version: 10, version_compile_machine: x86_64, version_compile_os: Win64), and I need to write some information in this MySQL Server through a SQL Server script (I need to connect multiple servers and I would like to center everything in this SQL Server. This MySQL server I'm talking about is one of them).
I've found many tutorials teaching to use linked servers, like the following: https://gunnarpeipman.com/mssql-mysql-linked-server/
I've configured the ODBC connection as a System DSN using both MySQL ODBC 8.0 Unicode Driver and ANSI Driver;
I could connect to the MySQL server, and list the tables in this server through SSMS's object explorer. Unfortunately, I spent A LOT of time trying to query data from this server, since I always get errors pointing as if I don't have enough permission to see columns from this table:
When trying to [right click table > Script table as > Select to > clipboard]
[DWGLUO].[dw_vtiger]..[dleads] contains no columns that can be selected or the current user does not have permissions on that object.
When trying to query some data with OPENQUERY:
SELECT * FROM OPENQUERY(DWGLUO_ANSI,'SELECT idlead FROM DWGLUO_ANSI.dw_vtiger..dleads')
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "SELECT idlead FROM DWGLUO_ANSI.dw_vtiger..dleads" for execution against OLE DB provider "MSDASQL" for linked server "DWGLUO_ANSI".
I can see all tables, but i can't see any columns :(
Also, by running the query below, I managed to find the column names, so they're there somewhere:
EXEC ('SELECT TABLE_SCHEMA,
TABLE_NAME,
COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = ''dleads''') AT DWGLUO_ANSI ;
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
dw_vtiger
dleads
idlead
dw_vtiger
dleads
nome
... (continues) ...
If someone could help me I would really appreciate it. Thank you all in advance.
While executing this query on the log analytics tool of the azure database
SELECT * FROM sys.event_log
Got the error as
Query could not be parsed at 'sys' on line [1,14]
Token: sys Line: 1 Position: 14
Azure Data Explorer support SQL however you need to escape it like this:
select * from [sys.event_log]
Azure Log Analytics does not support the SQL language and you have to use the "Kusto Query Language". You first need to find the table that has the data you are looking for and then use the "Kusto Query Language" to find the relevant data. There are many sample queries when you begin to use Azure Log Analytics.
I have an external data source created in DB1 and its pointing to DB2 database in Azure.
I want to query a UDF defined in DB2 from DB1.
Following syntax works, from DB1:
EXEC sp_execute_remote
N'Ext_DB2',
N'SELECT Result'
But I want to use following syntax:
select C1, C2, < function_in_DB2 >
from t1
I tried searching web, this format is not mentioned anywhere, is it not supported? Any pointers will help.
Thanks !
Just per my experience, I think Azure SQL database doesn't support it. As we know, we can't do cross database query directly.
Since none document talk about this, I would suggest you ask Azure SQL support to get more support, ref: How to create an Azure support request.
Hope this helps.
I am new to this forum and already searched for 45 minutes to find a solution for my problem. I hope you can help me.
A Gateway to a remote Microsoft SQL Database was installed on a Oracle Server (Oracle 12c). The tsnnames.ora file was appropiately set up.
For the connection, I created a database link (In the Oracle DB) as follows:
CREATE DATABASE LINK TEL CONNECT TO "fb_B2C" IDENTIFIED BY "passwort" USING 'dg1msql';
When I now execute the Select statement:
SELECT "name" FROM "sys"."databases"#TEL
it shows me the according databases. Among others, I can see the AB_Colors database.
Now, I want to select a view in the AB_Colors database.
Due to the fact I can connect to this database via Excel, I know that in the database AB_Colors, there are 10 Views(A,B,C,..). I would like to select the View C from the database AB_Colors via the DB LInk.
Owner of the View is b2b.
How do i need to formulate the select statement to do it?
I already tried different writings:
SELECT * FROM b2b.C#TEL;
SELECT * FROM "AB_colors"."b2b"."C"#TEL;
SELECT * FROM [AB_Colors].[b2b].[C]#TEL;
The common error message is: View/Table does not exist
I highly appreciate your help,
Fedja
This is the correct format
SELECT * FROM "b2b"."C"#TEL;
The issue maybe because the database you want to select from is not the one specified in the gateway for dg1msql. You can't add the database name to the query so you must specify it in the gateway connection.
This is defined in
$ORACLE_HOME/dg4msql/admin/initdg4msql.ora
where you should check HS_FDS_CONNECT_INFO
I have a folder with images (person photo) that need to be used in reporting and I want to save them in a SQL Server table. I am using SQL Server 2012 and I have created a table. I am neither an Admin(sa/dbo) nor I have permissions to use the BULK statement. I searched many sites but found none so far without BULK statement.
I have a userform developed in excel and using VBA to execute the insert query image to connect to sql with SSIS (if I am an admin the insert blob query executed successfully from my workstation) however if I am neither admin(sa/dbo) I tried using other workstation cause I have my sql server set up to allow access remotedly using tcp and open port 443. It fails to insert
Most people suggested using :
INSERT INTO PersonImage
SELECT * FROM
OPENROWSET(BULK "Imagepath", SINGLE_BLOB) AS image
I cannot use this or any statement with BULK in it. Could anyone of you suggest a way arround to load these images into the table with out using BULK INSERT statement?
Your help is appreciated!
Thanks and Regards