Questions tagged [openrowset]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
48 views

Can OPENROWSET authenticate with the signed in user running the query?

My architecture is as follows: On prem sql server database [Datawarehouse] Azure Analysis Services Tabular model [Sales] International report developers that query the [Datawarehouse] to develop ...
user avatar
  • 148
9 votes
3 answers
754 views

Is it possible to use OPENROWSET to import fixed width UTF8 encoded files?

I have an example data file with following contents and saved with UTF8 encoding. oab~opqr öab~öpqr öab~öpqr The format of this file is fixed width with columns 1 to 3 each being allocated 1 ...
user avatar
  • 78.2k
0 votes
0 answers
226 views

Trying to read a json lines file with OPENROWSET and cursor

I've got a pile of json lines files that I'm trying to process into a set of Sql Server database tables. Can't use OPENJSON() because jsonlines is not valid in total, only line by line. Plus the ...
user avatar
0 votes
1 answer
110 views

AWS EC2 Opendatasource to the same server - OLE DB provider "SQLNCLI11" for linked server "(null)"

Trying to run a Opendatasource query to point to the same server as the source server in AWS EC2, I got this message intermittently (once out of about 20 times, the other 19 times do get results back)....
user avatar
  • 93
1 vote
1 answer
191 views

Can SQL Server OpenQuery/OpenRowSet to an LDAP Linked Server be used for Authentication?

I can fetch data back from LDAPS (port 636/3269) by first creating a Linked Server using sp_addlinkedserver and sp_addlinkedsrvlogin. However, what I really need to do is to authenticate a Username/...
user avatar
0 votes
1 answer
59 views

Problem with IF / BEGIN / ELSE

I'm trying to run a select IF there's something inside a folder: INSERT INTO #tb (SubDirectory, Depth, [File]) EXEC master..xp_dirtree 'C:\folder\', 10, 1 This will populate a table with the ...
user avatar
  • 7,114
1 vote
1 answer
425 views

Error when using OPENROWSET from a View as a nonsysadmin

[SQL Server 2012] I am running into an issue regarding the usage of a non-sysadmin account calling a view which contains a OPENROWSET call that pulls from a stored procedure. I was wondering whether ...
user avatar
  • 11
0 votes
1 answer
129 views

OPENROWSET Bulk insert Text File NULL Columns

I need to automate a weekly import of .txt log files into a SQL database. I have already created my table, format file and can get some of the data to work using OPENROWSET BULK, but the data from the ...
user avatar
  • 425
0 votes
1 answer
1k views

How to insert into temp table on Server A results from dynamic SQL open query stored proc call to remote server B via Remote Query showplan operator?

I have to call a stored procedure on server B from server A using open query via dynamic SQL, and insert the results into a temp table created on server A. I noticed in the execution plan, it's using ...
user avatar
  • 24.8k
0 votes
1 answer
47 views

Are there any security implications with enabling "Data Access" on a sever?

I'm trying to run an OPENQUERY statement within a local server but am getting the following error: Server 'MyLocalServer' is not configured for DATA ACCESS. If I set MyLocalServer's Data Access ...
user avatar
  • 24.8k
2 votes
2 answers
599 views

SSMS - Openrowset maximum file size

Apologies if this has been answered elsewhere but I couldn't find anything here or online. Does openrowset have a file size limit? I'm trying to write a stored procedure, part of which checks if ...
user avatar
  • 135
1 vote
1 answer
472 views

How to bulk insert data in vertical into sql server?

My data in below format. I have to insert into sql server table. agency NO booknbr 06000330 bookdttm 2006-07-19 10:56:00 arrdttm 2006-05-07 05:42:00 aj_id A000009454 casenbr 06006640 ...
user avatar
2 votes
0 answers
176 views

BulkAdmin Role Doesn't Work

There is a query that our BI team use. They can not execute the query because of the error below. Ad hoc access to ole db provider 'MSDASQL' has been denied. You must access this provider ...
user avatar
  • 37
1 vote
0 answers
2k views

Import Date in proper format from Excel to SQL Server through OPENROWSET query

I am trying to import huge data without any data loss from excel sheet to SQL Server. The excel sheet has few columns with mixed data types and few column with dates. I have prepared a sample file as ...
user avatar
  • 765
2 votes
2 answers
4k views

specify delimiter in openrowset bulk insert

I'm trying to insert data from CSV files into tables using a cursor and open rowset bulk insert. this works for me 99% of the times but if one of the fields in the csv files contains a comma( , ) the ...
user avatar
  • 325
0 votes
2 answers
826 views

How to Use OPENROWSET function within a Transactional SSIS Package

I have an SSIS Package and one of its components is "Execute SQL TasK" and I've written an OPNEROWSET query inside this task. When I configure the transaction option of the whole package from "...
user avatar
0 votes
1 answer
90 views

Arithmetic overflow for Variable in Openrowset

I try to create a table to store the used storage Information for every Database. Since theese are hosted on different Cluster / Instances, I created a table with all Instance / Server Information. ...
user avatar
  • 15
1 vote
1 answer
2k views

Using "Where clause" In OPENROWSET as variable

I need to have a where clause in OPENROWSET but it is not always fix. It might be null sometimes. I have a procedure as you can see here : ALTER PROCEDURE [dbo].[OpenExcel] @TableName VARCHAR(2000) ...
user avatar
1 vote
2 answers
98 views

What is the potential fallout of changing SQL Server's log on account?

I need to be able to read files from a UNC path in TSQL and am getting an access denied error. I've read I must change the user SQL Server logs in as to a domain user, it's currently running as NT ...
user avatar
  • 273
3 votes
1 answer
3k views

SQL Server 2016 Linked Server OPENQUERY Hangs

I've been trying to figure out this linked server problem for about a week now with no luck. The set up I have is a linked server from an instance of SQL Server 2016 to an instance of SQL Server 2016 ...
user avatar
1 vote
0 answers
154 views

OPENROWSET error accessing XLSX if not manually saved

Good day, Apologies if this is in the wrong forum. Please refer me to the correct one if this is the case, thank you. I have a bunch of excel files that are added to a Dropbox folder on a monthly ...
user avatar
2 votes
1 answer
857 views

Use SPLIT_STRING with OPENROWSET

Is there a way to pass the result from OPENROWSET BULK into a variable so i can use STRING_SPLIT to divide it into rows? Something like: DECLARE @MyString = FROM OPENROWSET (BULK 'C:\Temp\File....
user avatar
  • 159
1 vote
1 answer
5k views

OPENROWSET returns just one row

Im trying to import values from a .csv file which has only one column. I keep getting all the values in just one row. SELECT BulkColumn FROM OPENROWSET (BULK 'C:\Temp\myfile.csv', SINGLE_CLOB) ...
user avatar
  • 159
6 votes
3 answers
4k views

How to retrieve a large text from inside a table?

for my own records I have a table in one of my servers where I like to save my activities and scripts the table definition is: IF OBJECT_ID('[dbo].[activity]') IS NOT NULL DROP TABLE [dbo].[...
user avatar
3 votes
1 answer
6k views

SQL Server service permissions on network share depending on IntegratedSecurity=true/false

Our company receives a daily file from one of our customers. It is an EDIFACT file translated to XML and downloaded from an SFTP server. We have developed one (c# console) application that: Download ...
user avatar
  • 22.8k
1 vote
1 answer
2k views

openrowset to connect to SQL server with a password containing single quotes

Can someone help me if there is ever a way to query an Azure SQL database using openrowset with an SQL authenticated account having "single quotes" in it's password string. My statement looks like the ...
user avatar
-1 votes
1 answer
5k views

SELECT with OPENROWSET from a stored procedure with parameter [closed]

I am trying to do a select with openrowset from a stored procedure with a parameter but it is not working. SELECT * FROM OPENROWSET( 'SQLNCLI', 'Server=SERVERNAME;Trusted_Connection=yes;...
user avatar
-1 votes
1 answer
362 views

How to execute OPENROWSET from SSRS

Trying to create a Dataset in SSRS that executes a stored procedure that imports data from an Excel file. The sproc transforms the imported data and outputs the reformatted data for the SSRS report. (...
user avatar
1 vote
1 answer
17k views

metadata could not be determined because stored procedure contains dynamic SQL

I have a stored procedure that contains some dynamic SQL. I am trying to execute the stored procedure using OPENROWSET but am getting the error: Msg 11514, Level 16, State 1, Procedure ...
user avatar
1 vote
0 answers
169 views

OpenRowSet sp_update mystery - Update returns row updated, but does not update row

/* SELECT @@VERSION Microsoft SQL Server 2016 (SP1-CU1) (KB3208177) - 13.0.4411.0 (X64) Jan 6 2017 14:24:37 Copyright (c) Microsoft Corporation Developer Edition (64-bit) on Windows 8.1 ...
user avatar
  • 333
0 votes
2 answers
1k views

Can OPENROWSET parameters be built dynamically?

This feels like an ‘obvious “yes” ‘ kind of question, but nevertheless: would it not be possible with OPENROWSET to have sub-queries regarding the file path that import for particular procedurally-...
user avatar
8 votes
1 answer
2k views

Where do Linked Server Queries get executed?

I have two instances ServerA and ServerB, and I have created a linked server in ServerA for ServerB as Linksrv_B. I can execute a query on ServerA using the four part naming convention: SELECT * ...
user avatar
9 votes
2 answers
16k views

The metadata could not be determined because statement invokes an extended stored procedure

in sql server 2012 I used to have a look at the jobs by getting the output of SP_HELP_JOB -- https://www.sqlservercentral.com/Forums/Topic259078-8-1.aspx -- getting data from sp_help_job into a temp ...
user avatar
0 votes
3 answers
2k views

How to Export Table sql to Excel file in sql server 2014?

I want to export tbl_category to excel file with code. I can export with the wizard but I want to create procedures to create excel file daily. tbl_category : 2 column contain : [id] is int and [...
user avatar
  • 171
2 votes
1 answer
1k views

how to temporarily change the sql server settings in order to do a task and when finished revert back?

when I run the script below all at once I get this error message: Msg 15281, Level 16, State 1, Line 58 SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc ...
user avatar
3 votes
1 answer
4k views

Is there an equivalent to OPENROWSET in Oracle?

Is there an equivalent to OPENROWSET in Oracle? From OPENROWSET (Transact-SQL): This method is an alternative to accessing tables in a linked server and is a one-time, ad hoc method of connecting and ...
user avatar
  • 1,387
3 votes
3 answers
2k views

9 digit zip codes are reporting LEN of 12

I am attempting to resolve some difficulties in getting zip codes to display properly. The original spreadsheet has zip codes of mixed 5 and 9 digit formats. After the import process, these 9 digit ...
user avatar
  • 1,051
2 votes
0 answers
378 views

Import from dbf - collation

I select data from dbf files through OPENROWSET Visual FoxPro OLEDB. Despite forcing collation on columns (e.g. SELECT name COLLATE Polish_CI_AS FROM Employees) the polish specific characters keep ...
user avatar
2 votes
0 answers
1k views

Errors while accessing Excel file using openrowset

I'm seeing the below error message while running the following T-SQL statement. select * FROM OPENROWSET( 'Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=123.xls', 'SELECT * FROM [Sheet1$]') ...
user avatar
  • 235
3 votes
2 answers
3k views

How to read an excel file from a network machine using SQL?

I am trying to import some excel file data into a SQL table. I thought of using OPENROWSET for this. The issue is that the csv file is location in a different machine in the same network. How do I ...
user avatar
  • 471
8 votes
4 answers
18k views

Get @@SERVERNAME from linked server

This seems like a basic question but I can't find any answers out there - I need to be able to get the server name/instance etc. from a linked server. I've tried a couple of things: select <linked ...
user avatar
  • 669
4 votes
1 answer
702 views

SSRS - ERROR NUMBER:7357 while passing multiple value parameters using comma delimited string to stored procedure

I am working on a SSRS report to display the logins permissions in a set of databases on a specific server. the server, the logins and the databases are all parameters. NULL shows them all (logins ...
user avatar
3 votes
1 answer
3k views

OPENQUERY and server permissions

when I run my stored procedure it is a complete success, even if I run it through exec. Running these: sp_GetServerLogins GO exec ( 'sp_GetServerLogins ') GO I get this: Needless ...
user avatar
1 vote
0 answers
2k views

Linked Server vs. Ad Hoc (OpenRowset / OpenDatasource) Distributed Queries

I have an application which needs to grab data from different clients' databases that reside at the client's location. So alongside their normal details such as company name, address etc, I also store ...
user avatar
1 vote
0 answers
675 views

Using loops inside Openrowset

I'm trying to execute a query across around 200 servers using openrowset function. This function needs to execute in a loop - the query is sucessfull in SQL Server 2012 environments, but failing in ...
user avatar
3 votes
2 answers
20k views

SQL Server - Linked Server - Using OPENROWSET with windows integrated security

I have seen many articles regarding OPENROWSET using integrated security (Windows Authentication), but I could not make it work for me. It is working fine using SQL Server authentication: select * ...
user avatar
1 vote
0 answers
225 views

Update Linked Server Provider

Is there anyway to update a linked server provider without dropping and recreating the linked server? The linked servers' provider need to be updated from SQLNCLI10 to SQLNCLI11 A coworker has ...
user avatar
  • 9,478
1 vote
0 answers
1k views

Exporting to excel from OPENROWSET with cell formatting

I am trying to generate a report from SSMS to Excel, using OpenRowSet. All is working fine, still I have to export a specific column with a barcode font. I already have the column calculated from ...
user avatar
3 votes
1 answer
2k views

How to UPDATE/DELETE/INSERT with Microsoft.ACE.OLEDB.12.0 as Linked Server in SQL Server 2012?

I need to update an Access 2003 database from SQL Server 2012 with the Microsoft.ACE.OLEDB.12.0 provider. As an administrator, everything works great. I can do Select, Insert, Update and Delete ...
user avatar
0 votes
1 answer
481 views

Backup/restore using OPENDATASOURCE OR OPENROWSET

Has anyone ever successfully taken a backup or restore to another server using OPENDATASOURCE/OPENROWSET? I am not able to use linked servers so I am exploring this idea.
user avatar