Distributed Query: Import XML Using OpenRowSet Bulk From UNC - Access Denied

Feb 26, 2008

I'm experiencing issues importing XML data using a distributed query with the following statement which is run from an XP client named WorkstationA connecting to SQL2005 SP2 ServerB, the XML data is located on ServerC.


AdHoc Queries using OpenRowSet has been enabled and verified.


The SQL Server service is running using a domain user account with permissions to read the remote files. I have logged in locally to the SQL server and verified this. It still fails even if the SQL services are running using LocalSystem.

User on Workstation A is authenticated with Integrated security (SQL Admin) and has rights to read the XML files on ServerC.

WorkStationA = SQL2005 Mgt Studio running the query
ServerB = SQL2005 SP2
ServerC = XML data files


DECLARE @xml XML
SELECT @xml =CONVERT(XML, bulkcolumn, 2)
FROM OPENROWSET(BULK '\SERVERCSHAREPATHDATAFILE.XML', SINGLE_BLOB) AS x
SELECT @xml


Results: Msg 4861, Level 16, State 1, Line 2

Cannot bulk load because the file "\SERVERCSHAREPATHDATAFILE.XML" could not be opened. Operating system error code 5(Access Denied).


The query fails when it is run from Workstation A connected to SQL ServerB querying data on ServerC via a UNC.
The query is succesful when it is run from the local SQL ServerB. The problem is with distributed queries.
The query is succesful when the XML files are local to the SQL server including referencing them via a local UNC

Thank you for any responses.



Hamish

View 4 Replies


ADVERTISEMENT

Bulk Insert -- Access Denied Issues - 2

Jun 7, 2006

Hi All
Same situation as described here , same issue.
SQL Server(SQL2005 on Windows2003) uses domain account. This domain account enabled to be trusted for delegation. Client connects to server using Windows auth. Client issues BULK INSERT with UNC path. Statement returns error:

Cannot bulk load because the file "\Serverpubfile.txt" could not be opened. Operating system error code 5(Access is denied.)SQL 2000 runs this statement successfully so statement and file are OK. Everyone has all permissions on network share. Domain account granted all permissions explicitly so there is no access troubles.
Audit show anonymous connections.
Question is - how to put delegation in work?

Thank you in advance,
Alexander Sinitsin

View 2 Replies View Related

Bulk Insert -- Access Denied Issues

Oct 11, 2005

Problem: Insert a network file in the DB using BULK Insert

View 50 Replies View Related

Access Is Denied Error On Bulk Insert Using UNC Filename

Mar 24, 2006


I want to do a bulk insert of a file located on a different machine then the SQL Server database.

machine1 and machine2 are running Windows Server 2003 Standard Edition. SQL Server v8.0 is running on machine2. Neither machine1 nor machine2 are in any domain. (These are servers at a hosting company.)


I use a UNC filename to specify the file to load. It looks something like this:

\machine1.someplace.com
eportdata
eport200602.txt

I get this error message when I attempt the bulk insert using SQL Query Analyzer:

Server: Msg 4861, Level 16, State 1, Line 1
Could not bulk insert because file '\machine1.someplace.com
eportdata
eport200602.txt' could not be opened. Operating system error code 5(Access is denied.).
The share reportdata on machine1 has READ permissions for EVERYONE. What do I need to do enable allow the database machine (machine2) to access the files on machine1?

Thank you in advance for you help.

Phil

View 10 Replies View Related

Cannot Bulk Load Because The File Could Not Be Opened. Operating System Error Code 5(Access Is Denied.).

Jan 23, 2007

I am facing a issue with bulk upload on Test Server.

Issue: When running Openrowset command from SQL server other that Test Server query runs fine when trying to run the same command from Test Server it gives error.

Msg 4861, Level 16, State 1, Line 1

Cannot bulk load because the file "\ServerNameinputFileName.csv" could not be opened. Operating system error code 5(Access is denied.).

For example: If the command is run from System A connecting to SQL Server instance on Test Server Test Server it gives this error. If the same command with same rights is run from any other SQL server instance say Dev1 its running fine.

If the command is run from Test Server connecting to any SQL Server instance including Test Server it is running fine.

Tried: 1) Given the read/write rights on shared folder, to user under which the SQL server service is running on Test Server

2) Given the read/write rights on shared folder to everyone.

Query:

SELECT DISTINCT * FROM OPENROWSET

(

BULK '\ServerNameinputFileName.csv',

FORMATFILE='\ServerNameFormat.xml'

)

AS FileList



Please provide me with some solution. What can be the reason for such behaviour?

View 22 Replies View Related

Ad Hoc Distributed Query Against MS Access

Aug 21, 2007

Hello,
I have been looking for an example of how to do an ad hoc distributed query to an MS Access database. I've tried this;

select * from OpenRowSet('Microsoft.Jet.OLEDB.4.0',
'\Server1DataCorporateCPSDailyToolsTest.mdb' ;'admin';'',Names)

I recieve an OLEDB provider error when I try it this way. The version of Access is 2003. The database 'Test.mdb' is on a network share, and the table is called 'Names'. The share is located on the machine that hosts SQL Server 2000.

Is there a setting in sql server that can be set to allow/disallow ad hoc distributed queries?

What am I missing?

Thank you for your help!

cdun2

View 5 Replies View Related

OpenRowSet With Excel DENIED

Oct 7, 2005

Same with OpenDataSource. SQL 2000, logged in as non-SA.Getting message:Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has beendenied. You must access this provider through a linked server.Can run with SQLOLEDB with connection string to same server(obviously), but when trying to access an Excel file, get the messageabove.It appears that the file name given in the connection string to Excelis with respect to the SQL server, so I have used UNC names to thefile. Nothing.Want to avoid DTS when it's a table that I need and can't use a linkedserver because it's always a one time thing.Any tips appreciated!

View 2 Replies View Related

Distributed Query From SS 2000 To Access Catalog Views On SS 2005 Via Linked Server

Aug 24, 2006

I am trying to write some admin only procedures which will collect information to one of my development server from other production and development servers.
 
I have created linked servers to access these other servers on the development server. This development server is SQL Server 2000 EE. Other servers which I want to access are 2000 and 2005 (vaious editions)
 
E.g I have another development server called PRODTEST which is SQL Server 2005 and on the development server I have created a linked server pointing to PRODTEST called TESTLINKSRV. I want to access new object catalog view (as I do not want to use sysobjects)
 
When I run the following query
 
SELECT * FROM [TESTLINKSRV].[DBNAME].[sys].[objects]
 
I get following error,
 
OLE DB error trace [Non-interface error:  OLE DB provider does not contain the table: ProviderName=' TESTLINKSRV ', TableName='" DBNAME "."sys"."objects"'].
 
Msg 7314, Level 16, State 1, Line 1
 
OLE DB provider ' TESTLINKSRV ' does not contain table '"DBNAME"."sys"."objects"'.  The table either does not exist or the current user does not have permissions on that table.
 
So I try this query
 
SELECT * FROM [TESTLINKSRV].[DBNAME].[sys.objects]
 
and I get following error
 
Msg 208, Level 16, State 1, Line 1
 
Invalid object name TESTLINKSRV.DBNAME.sys.objects'.
 
So bottom line is how do I access catalog views on a 2005 server from a 2000 server using linked server?
 
I hope someone understands what I am trying to achieve. Please let me know what is it that I am doing wrong.
Thank you

View 5 Replies View Related

Using Openrowset (bulk...) With Variable In Filespec

Sep 7, 2006

Hello,to accelerate loading xml data from many files into a table using openrowset (bulk...) I want to use a variable in the file specification and increment it within a loop similar to this:

declare @datnam varchar(100);
DECLARE @MyCounter int;
SET @MyCounter = 1;
set @datnam = 'c:XML_DatenPOS_LOG_200608_'+ltrim(str(@MyCounter))+'.xml';
INSERT INTO GK_TO_KFH_ADAPTER_XML_NS (LOC_ID, MSG_CONTENT)
SELECT @MyCounter, MSG_CONTENT
FROM (
SELECT * FROM OPENROWSET (BULK @datnam, SINGLE_CLOB)
AS MSG_CONTENT) AS R(MSG_CONTENT)

But I got the following error:

Msg 102, Level 15, State 1, Line 8
Incorrect syntax near '@datnam'.

Is there a way to this in that manner?
Or is the bcp utility an alternative?

Regards
Peter

View 3 Replies View Related

Openrowset(bulk '\server1c$file.txt') Fails!

Aug 3, 2007

select * from openrowset(bulk '\server1c$file.txt', SINGLE_BLOB) as t
works from sql server itself, but doesn't work from any other machine. I got
"Operating system error code 5(Access is denied.)."
I am running as the domain admin, the file.txt has full control for everyone. In server1 even log, I see Anonymous Logon.


Please help!

Thanks,

Bo

View 3 Replies View Related

Bulk Insert Acting Differently Than Openrowset

Feb 22, 2008

I am trying to import some data from csv files. When I try it using bulk insert I get a conversion error. When I use the exact same format file and data file with an openrowset it works fine. I would prefer to use the BULK insert as I can make some generic stored procedures to handle all my imports and not have to code the column names in the SQL. Any suggestions?



BULK Insert stuff

From 'c:projects estdatalist.txt'

with

(FORMATFILE='c:projects estdatamyformat.xml')


insert into stuff (ExternalId, Description, ScheduledDate, SentDate, Name)

select *

from OPENROWSET (BULK 'c:projects estdatalist.txt',

FORMATFILE='c:projects estdatamyformat.xml')

as t1


The destination table has more columns than the data file. The Field IDs represent the ordinal position of the columns in the destination table. Column 1 in the destination table is an int identity. The conversion failure is from trying to convert column 5 to int which makes me think bulk insert is ignoring the name attributes in the XML and just trying to insert the columns into the table in order without skipping.

<?xml version="1.0"?>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RECORD>
<FIELD ID="2" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="12"/>
<FIELD ID="5" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="200" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="7" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="24"/>
<FIELD ID="8" xsi:type="CharTerm" TERMINATOR=" " MAX_LENGTH="24"/>
<FIELD ID="9" xsi:type="CharTerm" TERMINATOR="
" MAX_LENGTH="500" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
</RECORD>
<ROW>
<COLUMN SOURCE="2" NAME="ExternalId" xsi:type="SQLINT"/>
<COLUMN SOURCE="5" NAME="Description" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="7" NAME="ScheduledDate" xsi:type="SQLDATETIME"/>
<COLUMN SOURCE="8" NAME="SentDate" xsi:type="SQLDATETIME"/>
<COLUMN SOURCE="9" NAME="Name" xsi:type="SQLVARYCHAR"/>
</ROW>
</BCPFORMAT>

View 1 Replies View Related

Import Excel-File (OPENROWSET) On X64 SQL Server

Jan 7, 2008

Hi, recently I encountered the following problem:
I tried to execute a stored procedure on the newly installed SQL 2005 Server (now on x64 Win Server 2003) which imports an Excel-File into a DB table.
We use OPENROWSET to access the Excel data. But I recognized this is dependent on Jet OLE DB which seems is not available for x64 windows.

Is there another way to import excel data using a stored procedure.

thank you in advance, rene

View 12 Replies View Related

OPENROWSET To Access Error

Jul 20, 2005

Hi ,I have been trying to connect to access database from SQL Server 7.0.This machine is having 7.0 as a default instance and 2000 as a namedinstance.Also the machine doesn't have access installed and Microsoft.Jet.4.0is of version SP8 for Windows 2000The access database is password protected.I have tried all, OPENROWSET, OPENDATASOURCE, linked server, and ODBC.These are some of the commands which I have tried but gives followingerror.*******************************************SELECT a.*FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','F:Geerimainilling.mdb';'bhagath';'bhagath', Employee)AS aServer: Msg 7303, Level 16, State 2, Line 1Could not initialize data source object of OLE DB provider'Microsoft.Jet.OLEDB.4.0'.[OLE/DB provider returned message: Cannot start your application. Theworkgroup information file is missing or opened exclusively by anotheruser.]**********************************************SELECT * FROM OPENDATASOURCE ('Microsoft.Jet.OLEDB.4.0','DataSource="F:Geerimainilling.mdb";User ID=bhagath;Password=bhagath;JetOLEDB:SystemDatabase="c:WINNTsystem32System.mdw"')...EmployeeServer: Msg 7303, Level 16, State 2, Line 1Could not initialize data source object of OLE DB provider'Microsoft.Jet.OLEDB.4.0'.[OLE/DB provider returned message: Cannot start your application. Theworkgroup information file is missing or opened exclusively by anotheruser.]**********************************************SELECT *FROM OPENROWSET('MSDASQL','Driver={Microsoft Access Driver(*.mdb)};Dbq=F:Geerimainilling.mdb;Uid=bhagath; pwd=bhagath','SELECT*FROM Employee')Server: Msg 7399, Level 16, State 1, Line 1OLE DB provider 'MSDASQL' reported an error.[OLE/DB provider returned message: [Microsoft][ODBC Driver Manager]Data source name not found and no default driver specified]**********************************************I have tried all possible combinations but most of the time I come upwith Error 7399.In case if anyone has some other syntax and successful with that,please let me knowRegards,Mahesh

View 1 Replies View Related

Data Access :: Server Rejected The Connection - Access To Selected Database Has Been Denied

Jun 10, 2015

I have recently upgraded to SQL2014 on Win2012. The Access front end program works fine.

But, previously created Excel reports with built in MS Queries now fail with the above error for users with MS 2013.  The queries still work for users still using MS 2007. 

I also cannot create any new queries and get the same error message. If I log on as myself on the domain to another PC with 2007 installed it works fine, so I don't think it is anything to do with AD groups or permissions.

View 6 Replies View Related

Access Denied Error Message Using Xp_cmdshell To Access Network Share

Jan 14, 2007

When running the following statement in SQL 2005, I get the error message "Access is denied":

exec master.dbo.xp_cmdshell 'TYPE \SERVER-BSHAREFILE.TXT'



The following are true about the network:

The SQL Server is installed on SERVER-A.
SERVER-A and SERVER-B are Windows 2003 servers on the same Windows 2003 domain.
The SQL Server and SQL Server Agent services are running under the domain account SQLSERVICE.
SQLSERVICE is a member of the Domain Admins group.
The Domain Admins group is part of the local Administrators group on SERVER-B.
The SQLSERVICE account has also explicitly been given Full Control to the folder referenced by \SERVER-BSHARE
xp_cmdshell use has been enabled on the SQL Server.


If I run the following command in SQL:

exec master.dbo.xp_cmdshell 'whoami'the following is returned: DOMAINSQLSERVICE
If I change the command to access the c: drive instead of a network drive, it executes successfully.

Can anyone shed some light on why I still cannot access any of the files in this folder using xp_cmdshell?

Tim

View 5 Replies View Related

T-SQL (SS2K8) :: Access EXCEL Using OPENROWSET

May 22, 2014

I'm trying to access Excel file from SQL Server management studio using OPENROWSET using the below query but getting the error listed below.

Query:
SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0 Xml;HDR=YES;Database=E:TestFilesExcelFile.xlsx',
'SELECT * FROM [Sheet1$]'
)

Error:
Msg 7415, Level 16, State 1, Line 2
Ad hoc access to OLE DB provider 'Microsoft.ACE.OLEDB.12.0' has been denied. You must access this provider through a linked server.

View 9 Replies View Related

Can Not Access Excel File Using OpenRowset

Aug 8, 2007



I am using SQLServer 2005 SP2. I enabled the Ad Hoc Distributed Queries and DisallowAdhocAccess registry option is explicitly set to 0. Query is working fine when I remote desk to the server and execute when I run same query from my workstation I am getting following error


Msg 7399, Level 16, State 1, Line 1

The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" reported an error. The provider did not give any information about the error.

Msg 7303, Level 16, State 1, Line 1

Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".


Any help is appreciated.
Thanks
--
Farhan

View 8 Replies View Related

Data Access :: Server Does Not Exist Or Access Denied

Apr 22, 2015

When i am trying to start our hospital software based on SQL server 2000, it shows Following Error.Search Condition is not valid, (DBNETLIB) Connection Open (connect()).  SQL server does not exist or excess denied. Due to Fetch data.I run our software in Windows 8.1, while it smothly runs in previous version of Windows XP and 7.

View 2 Replies View Related

OPENROWSET Problem Connecting To Access Database

Jun 27, 2007

Hi all,

For a flexible import in our SQL database (SQL 2000 on a Windows 2003 server) we use OPENROWSET. In our development on a local instance of SQL Server, we have no problems with a connection to Accesss. However, when we deploy the same code with the same Access database to our test server we get an error indicating to use a Linked Server.

We set all neccessary parameters for allowing ad hoc queries and encounter no problems with queries to different SQL Servers and Oracle databases. Also, when we execute the query to the Access database on a local disk from a job, it works fine. Run the same query to an Access database on a fileshare from a job results in an error.

How come the OPENROWSET selection cannot be run from the query analyser or to an Access database on a fileshare? What security settings are blokking?

We use the following query:
SELECT top 10 *
FROM
OPENROWSET(
'Microsoft.Jet.OLEDB.4.0',
'C:Testdata est.mdb';
'admin';'',Table1)

Thanks for all your help,
Nils

View 1 Replies View Related

What Syntax Should I Use To Connect To Access DB (having System Database) Via OPENROWSET?

Aug 9, 2007

MS SQL Server 2005 Express.
I'm trying to connect to Access DB (having System Database) via OPENROWSET.
Everything (client, server and access file) is on local drive.

This works (ODBC):


select *
from openrowset('MSDASQL',
'Driver={Microsoft Access Driver (*.mdb)};Dbq=C:MBK.mdb;SystemDB=C:SECURED.MDW;Uid=me;Pwd=pw;',
'select * from [Mbk]')

This works (Jet.OLEDB):

select *
from opendatasource('Microsoft.Jet.OLEDB.4.0',
'Data Source=C:MBK.mdb;Jet OLEDBystem Database=C:SECURED.MDW;User ID=me;Password=pw;')
...Mbk

This won't work (Jet.OLEDB):

select *
from openrowset('Microsoft.Jet.OLEDB.4.0',
'MS Access;Database=C:MBK.mdb;System Database=C:SECURED.MDW;UID=me;PWD=pw;',
'select * from [Mbk]')

saying ... "Wrong argument".

This won't work (Jet.OLEDB):

select *
from openrowset('Microsoft.Jet.OLEDB.4.0',
'MS Access;Database=C:MBK.mdb;SystemDB=C:SECURED.MDW;UID=me;PWD=pw;',
'select * from [Mbk]')

saying ... "There are no permissions for usage of object C:MBK.mdb". It seems that it simply hasn't found system database file C:SECURED.MDW, cause when I change SystemDB=C:SECURED.MDW to something like BlahBlahBlah=C:SECURED.MDW the same message is shown.

So, what is the right syntax for stating System Database in OPENROWSET query string? And why 'System Database' won't work?

Thank you.

View 1 Replies View Related

HELP: How To Access Lotus Notes Database Using SQL 2005 Openrowset Command?

Mar 3, 2008

Any advice on how to achieve the above, if possible, would be greatly appreciated.

Cheers,
j.

View 1 Replies View Related

SSIS Package Access Files Via Openrowset Strange Problem?

Sep 7, 2007

I have three machine:

S: Running SQL Server Express
V: Running SSIS package in VS.Net
F: Shared folder host excel files

And an openrowset SQL statement: select * from openrowset(..... \Fexcel.xls....). This statement can be run in SS management studio connecting to S using my Windows logon(integration security) without any problem.

However, the same SQL running inside SSIS package (integration security using my Windows account) get the following error:


Error: 0x0 at Check headers: OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "The Microsoft Jet database engine cannot open the file '\Fexcel.xls'. It is already opened exclusively by another user, or you need permission to view its data.".

Error: 0xC002F210 at Check headers, Execute SQL Task: Executing the query "....openrowset....." failed with the following error: "Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.



(My Windows account is administrator of Windows and sysadmin or SQL Sever Express on S)

View 1 Replies View Related

Import Data From MS Access Databases To SQL Server 2000 Using The DTS Import/Export

Oct 16, 2006

I am attempting to import data from Microsoft Access databases to SQL Server 2000 using the DTS Import/Export Wizard. I have a few errors.

Error at Destination for Row number 1. Errors encountered so far in this task: 1.
Insert error column 152 ('ViewMentalTime', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Insert error column 150 ('VRptTime', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Insert error column 147 ('ViewAppTime', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Insert error column 144 ('VPreTime', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Insert error column 15 ('Time', DBTYPE_DBTIMESTAMP), status 6: Data overflow.
Invalid character value for cast specification.
Invalid character value for cast specification.
Invalid character value for cast specification.
Invalid character value for cast specification.
Invalid character value for cast specification.

Could you please look into this and guide me
Thanks in advance
venkatesh
imtesh@gmail.com

View 4 Replies View Related

Error Trying To Import MS Access 2003 Database Via SQL Server Import And Export Wizard - Too Many Sessions Already Active

Nov 29, 2006

I am trying to simplify a query given to me by one of my collegues written using the query designer of Access. Looking at the query there seem to be some syntax differences, so to see if this was the case I thought I would import the database to my SQL Server Developer edition.

I tried to start the wizard from within SQL Server Management Studio Express as shown in one of the articles on MSDN which did not work, but the manual method also suggested did work.

Trouble is that it gets most of the way through the import until it spews forth the following error messages:

- Prepare for Execute (Error)
Messages
Error 0xc0202009: {332B4EB1-AF51-4FFF-A3C9-3AEE594FCB11}: An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft JET Database Engine" Hresult: 0x80004005 Description: "Could not start session. Too many sessions already active.".
(SQL Server Import and Export Wizard)

Error 0xc020801c: Data Flow Task: The AcquireConnection method call to the connection manager "SourceConnectionOLEDB" failed with error code 0xC0202009.
(SQL Server Import and Export Wizard)

Error 0xc004701a: Data Flow Task: component "Source 33 - ATable" (2065) failed the pre-execute phase and returned error code 0xC020801C.
(SQL Server Import and Export Wizard).

There does not seem to be any method of specifying a number of sessions, so I don't see how to get round the problem.

Does anyone know how I can get the import to work?

View 2 Replies View Related

Bulk CSV File Import?

May 25, 2004

Hi, don't know how to do this,

i've got 100+ .CSV text files (50mb in total, not each) i need to import into a SQL server database but don't know how.

i've tried hunting the web for some file concatenation program but just came against pay-for-me software, which didn't help.

any ideas?, would the BCP command do it?

View 14 Replies View Related

Bulk Import Error

Feb 26, 2013

This is my source data in CSV format:

4,23,2AY5623,7235623
4,23,2GP1207,1451207
4,23,2GQ6689,4186689

Table:

CREATE TABLE [dbo].[Table1](
[idCodeLevel] [int] NOT NULL,
[idFirm] [int] NOT NULL,
[valCodeFrom] [varchar](15) NOT NULL,
[valCodeTo] [varchar](15) NOT NULL
) ON [PRIMARY]

[code]....

I googled and found out that I might have to use the format .fmt. But how can I convert a csv file to fmt. I have seen code to create fmt file from sql table.

View 5 Replies View Related

BULK IMPORT Stress

Jul 26, 2006

I am trying to import a data file, which is tab delimited, using BULKINSERT. I have used BCP to create a format file, since the destinationtable has around 20 columns, but the data file has only three.Here's the problem: The columns I am trying to import comprise ID (anint identity column), Name (a varchar(255) column and Status (a smallint column). The data file contains identity values for the firstcolumn, so I am using the KEEPIDENTITY modifier. The Status column ismandatory, so I have set all rows in the data file to zero for thatcolumn. All of the other columns in the destination table either allowNULL or have default values. When I BULK INSERT the file using theformat file the identity columns are NOT imported and the Status columngets value 3376. The Name column is the only one that gets importedcorrectly. Here's the format file:8.031 SQLINT 0 4 " " 1 ID""2 SQLCHAR 0 0 " " 2 NameSQL_Latin1_General_CP1_CI_AS3 SQLSMALLINT 0 2 "" 4 Status""Sorry it's a bit messy.Where is 3376 coming from, and why are my identity values for column IDnot being imported?

View 3 Replies View Related

Bulk Import From A Remote Machine

Jul 11, 2001

Hi folks,

We are trying to import a flat file from a remote machine using the BULK INSERT command.

We have mapped the remote directory on the server.

we have used the following command.

Bulk insert table_name from my_servermy_sharefilename.txt

The error it gives is operating system Error number 5.( Access denied)

We are able to access the same file from the Windows explorer. We also refered the books online and as suggested,
have set the System Path to the same share name.

But it does not work.

Could you help us in this regard.

Thanks.

-Rajesh

View 2 Replies View Related

Import Data With Bulk Insert

Jun 25, 2014

I have imported data in my table using the bulk insert command. I was supposed to fill specific columns of my table with that data so I used a view to put them in the column I wanted.

The table looks like this now:

id | id_param | val_param
+-----------+--------------+
1 | no_tel | 742062141
2 | sex | 1
3 | age | 23
4 | no_tel | 765234157
5 | sex | 1
6 | age | 34

When I want to select only the val_param that is=1 for the id_param=sex using this interogation:

select * from bd_rox where id_param='sex' and val_param='1'

it returns no value and I don`t know why.The wanted result should look like this:

id | id_param | val_param
+-----------+--------------+-
2 | sex | 1
5 | sex | 1

View 9 Replies View Related

Bulk Insert, Bcp For Import Log File In Sql

Mar 11, 2008

i have a log file, i am trying to import data from it to SQL in order to analyze the data (able to query on the data), however that task seems impossible.
In fact the log file contains a varying number of column fields (error logged, various types of data logged demand varying number of columns). More than that the fields themself are hard to extract.

An example of data in my log is:xxxxxxxx is some alphanumeric chars2008-01-09 20:16:05,4784E36F.req,10.1.1.26,xxxxxxxxx,OK -- SMPP - xxxxxxx:xxxxx,Sender=xxxx;SMSCMsgId=2028eecc;Binary=1;DCS=8;Data=xxxxxxxxxxxxxx...2008-01-09 20:16:05,4784E338.req,10.1.1.26,xxxxxxxx,Retry Pending - ERROR: Timeout waiting for response from server or lost connection -- SMPP - xxxxxxxxxxx:xxxxx,Sender=xxxxx........



I may use regular expressions to extract the data, and maybe use a regular INSERT to put in the right table. Thus it seems like making a manual Bulk Insert(yeah and it may take much more time), it seems strange, can i use somehow some additional tool (in SQL package or external), to assist somehow.

Thanks and sorry if this is double posted !

View 1 Replies View Related

Need To Set A Conditional Default Value For Bulk Import

Feb 27, 2008

Let me preface this request with the info that I am relatively new to sql server so I may be asking something that is rally basic, and/or is not a best practice but here goes....I need to import data from an excel spreadsheet - one of the columns may be null or may have an integer value. I'd like to replace any null values with a 1 during import so that calculations can be done with the field once the data are imported. Can someone give me an example of how to do this? I had planned to use the bulk insert option but if there's a better way please let me know. Thanks in advance for any advice.

View 3 Replies View Related

Bulk Import Data To SQL Mobile

Jul 26, 2006

Hi!.

Is there something like BCP utility in SQL CE?

I need to import (pereodicaly) large ammount of data to my CE database. When tested import on network this take a lot of time. That's why decided to send raw data in ASCII files (because of small size) and to import files to CE database.

Certainly, it's not a problem to write those cli by myself, but it's interesting if someone already did this...

Thanks, Sandr

View 3 Replies View Related

SQL Server 2014 :: Bulk Import XML To Table

Jun 19, 2014

I found loads of things but nothing seems to work...

I'm trying to get a link with XML data inside the page into a table but I can't find anything

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved