Questions tagged [openrowset]

OPENROWSET is a T-SQL function that can be used in Microsoft SQL Server to read remote data from an OLE DB data source. It also supports bulk operations that can read data from a file and return it as a rowset.

OPENROWSET is a T-SQL (Transact-SQL) function that can be used to read remote data from many sources, for example an OLE DB data source or a file from the file system.

This method is an alternative to accessing tables in a linked server and is a one-time, ad hoc method of connecting and accessing remote data by using OLE DB. For more frequent references to OLE DB data sources, use linked servers instead.

OPENROWSET also supports bulk operations through a built-in BULK provider that enables data from a file to be read and returned as a rowset.

The OPENROWSET function can be referenced in the FROM clause of a query as if it were a table name. The OPENROWSET function can also be referenced as the target table of an INSERT, UPDATE, or DELETE statement, subject to the capabilities of the OLE DB provider. Although the query might return multiple result sets, OPENROWSET returns only the first one.

354 questions
0
votes
1 answer

pass dynamic file path of excel to "OPENROWSET"

I want pass dynamic URL of excel to "OPENROWSET". NOTE - I am passing returned result of excel file to cursor. I want to pass file path to "@excelpath", I have tried many ways but its giving syntax error. ALTER procedure [dbo].[import_excel] ( …
Abhi
  • 1,963
  • 7
  • 27
  • 33
0
votes
1 answer

Failing to delete record from linked server

I've spent the past two days searching everywhere for a solution to my problem but without any luck. I have this query that deletes record from a remote server: delete from OPENROWSET('SQLNCLI',…
Moshe Derri
  • 206
  • 2
  • 11
0
votes
2 answers

CSV FormatFile for OPENROWSET BULK catering for both plain COMMA and "COMMA"

Possible Duplicate: SQL Server Bulk insert of CSV file with inconsistent quotes I have been given a million row CSV to import into SQL Server that is basically like this: "A",B,C,D,"E","F" I have done it ok in the past using OPENROWSET BULK and a…
DomBat
  • 1,981
  • 5
  • 27
  • 42
0
votes
0 answers

How to call SPs with #temp using OpenRowSet in a View?

I am trying to run a stored procedure from an application which supports connecting to only tables and views. My work around was to use a view which gets results from SP via Openrowset(). Turns out that the SP is using #temp tables to store…
Faiz
  • 5,331
  • 10
  • 45
  • 57
-1
votes
2 answers

how to set bulk_options in openrowset to read file from Azure blob storage?

I have an Azure SQL database and would like to read a csv file from Azure blob storage (gen 2) with openrowset. However, the output lacks proper formatting, as rows and columns are not separated. In the csv file, FIELD TERMINATOR is '|' and ROW…
Sara
  • 9
  • 3
-1
votes
3 answers

I am getting an error Incorrect syntax near 'OPENROWSET'. while using openrowset function on dedicated SQL Pool

First I added a credential: CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'Mumbai@1234'; GO CREATE DATABASE SCOPED CREDENTIAL credanubhav -- this name must match the container path, start with https and must not contain a trailing forward slash. …
Anubhav
  • 273
  • 2
  • 8
-1
votes
1 answer

Unable to remove red underlines for XML import object in SQL Server Select

I am importing an XML file into SQL Server 2019 using SSMS from a Windows 10 desktop. The script works but there are red underlines showing in the editor that make the code look like something is wrong. I have tried closing SSMS and reopening but…
Robertcode
  • 911
  • 1
  • 13
  • 26
-1
votes
1 answer

How to parse Json from Blob in Azure SQL Database

I am not sure what is the most efficient way to do this, should I be using openrowset to read file to a single varchar(max) column (in the table) and cross appy OPENJSON (something like below), or is there a more efficient way? SELECT * FROM …
Gokhan
  • 279
  • 3
  • 13
-1
votes
2 answers

SQL Server : 2 Stored Procedure 1 for XML & one for data

I have 2 systems that use the same stored procedure. The problem is that one system needs data as normal select statement inside the stored procedure, while the other needs the data in XML format I just looking for best practice, do I have to…
asmgx
  • 7,328
  • 15
  • 82
  • 143
1 2 3
23
24