473,856 Members | 1,605 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TransferText dropping fractions

I've got a csv that I am trying to import into a SQL Server (2000)
table through an adp (Access 2000). The form used gives the user the
ability to browse for a file, then will import the file into a temp
table for processing using this vba code:

DoCmd.TransferT ext acImportDelim, , "tmpPaTimeClock 2", Me!TimeFileName ,
False

When I run the import through the code, the import is dropping any
values less than one (apparently). I've got a couple of columns that
have .5 for the value, but these are brought in as 0. Decimal places
are being imported (ex. 532.28 comes in correctly as 523.28)

I've tried changing the datatype in the temp table, but that doesn't
seem to make a difference.
I've tried letting the import create a new table, but that doesn't fix
the problem either.

If I import the file directly through the adp (right click - import)
all of the values are brought in correctly.

Anyone know how to fix this, or an alternative? I did some reading on
bcp and Bulk Copy, but I couldn't see an easy way to allow for the
variable path name to the file.

Dec 20 '05 #1
12 2221
Have you tried using a saved import spec with the data typ defined?

--
Danny J. Lesandrini
dl*********@hot mail.com
http://amazecreations.com/datafast
<ck****@mindspr ing.com> wrote ...
I've got a csv that I am trying to import into a SQL Server (2000)
table through an adp (Access 2000). The form used gives the user the
ability to browse for a file, then will import the file into a temp
table for processing using this vba code:

DoCmd.TransferT ext acImportDelim, , "tmpPaTimeClock 2", Me!TimeFileName , False

Dec 20 '05 #2
Danny's probably closer on the ball than I am here, but after trying
his suggestion I would consider changing some of your .5 values to 0.5
and seeing how they import.

Dec 20 '05 #3
I don't seem to get the option to save the import spec when I define
one. I assumed that import specs can only be saved when dealing with
and .mdb. I could be wrong on that though.

Dec 20 '05 #4
ck****@mindspri ng.com wrote:
I don't seem to get the option to save the import spec when I define
one. I assumed that import specs can only be saved when dealing with
and .mdb. I could be wrong on that though.

Click on your Advanced Button when defining specs.
Dec 21 '05 #5
(ck****@mindspr ing.com) writes:
Anyone know how to fix this, or an alternative? I did some reading on
bcp and Bulk Copy, but I couldn't see an easy way to allow for the
variable path name to the file.


For BCP this is just part of the command line, so it should be problem
to build that command line.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 22 '05 #6
After a bit of reading on bcp, it appears that Bulk Insert is a good
fit for what I am trying to accomplish (and I can run it through
T-SQL!!)
But I'm getting an error that seems to indicate that the OS can't find
the file.

Here's the code I'm using:
BULK INSERT dbo.tmpPaTimeCl ock FROM 'C:\Program Files\Traverse
CWIN\PER_HRS1.C SV'
Error :
Server: Msg 4861, Level 16, State 1, Line 1
Could not bulk insert because file 'C:\Program Files\Traverse
CWIN\PER_HRS1.C SV' could not be opened. Operating system error code
3(The system cannot find the path specified.).
That path is on my local machine.. Does Bulk Insert operate from the
Server box, so the path I enter has to be a path to a folder on the
machine where the SQL Server is running?

Dec 27 '05 #7
(ck****@mindspr ing.com) writes:
After a bit of reading on bcp, it appears that Bulk Insert is a good
fit for what I am trying to accomplish (and I can run it through
T-SQL!!)
But I'm getting an error that seems to indicate that the OS can't find
the file.

Here's the code I'm using:
BULK INSERT dbo.tmpPaTimeCl ock FROM 'C:\Program Files\Traverse
CWIN\PER_HRS1.C SV'
Error :
Server: Msg 4861, Level 16, State 1, Line 1
Could not bulk insert because file 'C:\Program Files\Traverse
CWIN\PER_HRS1.C SV' could not be opened. Operating system error code
3(The system cannot find the path specified.).
That path is on my local machine.. Does Bulk Insert operate from the
Server box, so the path I enter has to be a path to a folder on the
machine where the SQL Server is running?


Yes, that's it. SQL Server is a server, and all file specifications are
in the context of the server. If your disk can be reached throgh a UNC
path from the server, it can still read from your box. (Provided that
SQL Server is running under a domain user, I should add.)
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 27 '05 #8
The file is actually stored on the server, so the path shouldn't be a
problem.

However, I'm getting an error returned from this Bulk Insert command:
BULK INSERT dbo.tmpPaTimeCl ock
FROM '\\Csi\c\Tmp\PE R_HRS1.CSV' WITH (DATAFILETYPE = 'char', FIRSTROW
=1)
Server: Msg 4866, Level 17, State 66, Line 1
Bulk Insert fails. Column is too long in the data file for row 1,
column 1. Make sure the field terminator and row terminator are
specified correctly.
Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'STREAM' reported an error. The provider did not give
any information about the error.
OLE DB error trace [OLE/DB Provider 'STREAM' IRowset::GetNex tRows
returned 0x80004005: The provider did not give any information about
the error.].
The statement has been terminated.

Here's the first couple of rows from the import file:

Employee,Range of timeclock poll,,Earning
Codes,,,,,,,,,, ,,,,,,,,,,,,,,, ,,,,
96,11/29/2005,12/5/2005,REGULAR,OV ERTIME,DBL-TIME,SICK,HOLID AY,VACATION,SAT
OT,MON OT,JURY,HOL
OT,BRVMNT.,PD12 ,PD13,PD14,PD15 ,PD16,PD17,PD18 ,PD19,PD20,PD21 ,PD22,PD23,PD24 ,PD25,PD26,PD27 ,PD28,PD29,PD30
,6790,6790,0,0, 0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0 ,0,0,0,0,0
"ACEVEDO, JULIO
",1388,3107,40, 0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0 ,0,0,0,0,0,0
"AGULAR, MARTHA
",1401,4401,40, 0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0 ,0,0,0,0,0,0

When I alter the command to :
BULK INSERT dbo.tmpPaTimeCl ock
FROM '\\Csi\c\Tmp\PE R_HRS1.CSV' WITH (DATAFILETYPE = 'char', FIRSTROW
=3) the error goes away (skipping to first 2 rows), but no records are
imported???

Dec 27 '05 #9
(ck****@mindspr ing.com) writes:
The file is actually stored on the server, so the path shouldn't be a
problem.

However, I'm getting an error returned from this Bulk Insert command:
BULK INSERT dbo.tmpPaTimeCl ock
FROM '\\Csi\c\Tmp\PE R_HRS1.CSV' WITH (DATAFILETYPE = 'char', FIRSTROW
=1)
Server: Msg 4866, Level 17, State 66, Line 1
Bulk Insert fails. Column is too long in the data file for row 1,
column 1. Make sure the field terminator and row terminator are
specified correctly.


How about reading the error message? :-) It says: "Make sure the field
terminator and row terminator are specified correctly.". Did you do
that? No, the default field terminator is tab.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 27 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
6654
by: selowitch | last post by:
I've been searching in vain for a way to present typographically correct fractions (not resorting to <sup> and <sub> tags) but have been frustrated by the fact that the glyphs for one-half, one-eighth, three-quarters, etc. do not display in the correct typeface (or even consistently the same typeface) and seem totally resistant to attempt to fix this through CSS: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"...
2
4707
by: BigData | last post by:
I am attempting to create a delimited text file by using DoCmd.Transfertext as shown here. DoCmd.TransferText acExportDelim, "ExportSpec", "QryFinalExport", "Fileout.txt" This works fine as long as I load the .mdb or .mde directly and run. However, for various reasons, I need to reference this .mdb/.mde from my main .mde and then run the transfertext in the referenced .mde.
3
9437
by: Oliver Gabriel | last post by:
Hi, i want to export a table for later import, using vba. That´s my code: export: filename = "C:\HVOtabelle.txt"
12
1921
by: ckirby | last post by:
I've got a csv that I am trying to import into a SQL Server (2000) table through an adp (Access 2000). The form used gives the user the ability to browse for a file, then will import the file into a temp table for processing using this vba code: DoCmd.TransferText acImportDelim, , "tmpPaTimeClock2", Me!TimeFileName, False When I run the import through the code, the import is dropping any values less than one (apparently). I've got a...
3
2650
by: Jim M | last post by:
I am trying to 'grab' a backend data path and filename from a text file (to be used when updated front ends are installed by users). I store this information by running: DoCmd.TransferText acExportDelim, , "qExportBackEndPath", Local_TxtFileName, True qExportBackEndPath simply pulls the text field 'BackEndPath' from my tblLocal, which has only one record containing a fields related to
0
2038
by: Sean Howard | last post by:
I have a strange problem linking tab delimited text files in Access 2000 (I am running Windows XP), please try this and let me know if I am going mad. Step 1. Create the tab-delimited text file below in WordPad and call the file "HeaderYES.txt" (the space between the two fields is actually a tab):- "Column1" "Column2" 1 "Line1"
0
423
by: stuart | last post by:
I seem to have a problem with the use of the TransferText function. In 2 applications that I have, every few months, it seems to not export a few records from a table. In another application, every 2-3 months the users would start getting run time errors after they exported data from my program. Is anyone aware of problems with this function with these kind of results. The following is a code fragement:
1
1642
by: Semajthewise | last post by:
Here it is cleaned up a little more. Here's what this code does. It will take 2 fractions and add, subtract, multiply, or divide them. The user enters the fractions to be calculated into two textboxes. These can be entered as a whole number and a proper fraction, whole number and an improper fraction, just a proper/inproper fraction, or just a whole number. Form build Requirements: using Microsoft Visual Studio.NET 2003 single form...
0
1249
by: Paddy | last post by:
(From: http://paddy3118.blogspot.com/2008/09/python-fractions-issue.html) There seems to be a problem/difference in calculating with the new fractions module when comparing Python 26rc2 and 30rc1 I was reading the paper "Interval Arithmetic: Python Implementation and Applications" and thought to try the first example function f(x,y), which needs more precision than Python floating point provides (on my Windows PC), to calculate a...
0
9920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9764
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11063
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10699
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10790
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10390
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9535
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7932
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5960
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.