473,668 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Importare dati con bcp in sql server 2000

STB
Salve Ragazzi!!!
ho un problema che non riesco a risolvere e spero di riuscirci con il
vostro aiuto...
dunque..
ho un file csv tipo questo

Date,Aircarrier ,CallSign,ComFl tNbr,AcReg,AIPT Dep,AIPTDst,STD ,STA,AOBT,ATA,C ancellationDate
01/2004,AZ,,0735,I DATD ,SKG,MXP,01/01/04 04:20,01/01/04 06:45,01/01/04
04:20,01/01/04 06:28,
01/2004,AZ,,1712,I BIKA ,CTA,MXP,01/01/04 05:00,01/01/04 07:05,01/01/04
05:00,01/01/04 07:06
01/2004,AZ,,1176,I DAVR ,SUF,MXP,01/01/04 05:10,01/01/04 06:55,01/01/04
05:10,01/01/04 06:48,
01/2004,AZ,,1642,I DAVS ,BDS,MXP,01/01/04 05:15,01/01/04 06:55,01/01/04
05:15,01/01/04 06:51
01/2004,AZ,,1650,I DACX ,PSA,MXP,01/01/04 05:20,01/01/04 06:10,01/01/04
05:20,01/01/04 06:15,
01/2004,AZ,,1760,I DACV ,PMO,LIN,01/01/04 05:20,01/01/04 06:55,01/01/04
05:20,01/01/04 07:01,
01/2004,AZ,,1734,I BIKO ,CTA,FCO,01/01/04 05:25,01/01/04 06:45,01/01/04
05:35,01/01/04 06:52,

e lo importo con la bcp server.dbo.tabl e in file.csv -T -c -t, -r\n.

dunque cosa succede...
come avrete notato per il campo CancellationDat e il carattere di fine
riga coincide con il carattere che delimita il campo... che poi
sarebbe \n
dunque...se faccio una importazione da DTS con file type Text ANSI,
Row delimiter {CR}{LF} e text qualifier <none> tutto funziona molto
ok...
devo però importare file da posizioni diverse su disco e con nomi
diversi, quindi mi torna molto meglio usare da una stored procedure
master..xp_cmds hell @appo con @appo = 'bcp server.dbo.tabl e in
file.csv -T -c -t, -r\n'.
il problema è però che con questa importazione ho una situazione di
questo genere...

Date Aircarrier CallSign ComFltNbr AcReg AIPTDep AIPTDst STD STA AOBT ATA CancellationDat e
01/2004 AZ 0735 IDATD SKG MXP 01/01/04 04:20 01/01/04
06:45 01/01/04 04:20 01/01/04 06:28
01/2004 AZ 1712 IBIKA CTA MXP 01/01/04 05:00 01/01/04
07:05 01/01/04 05:00 01/01/04 07:06
01/2004 AZ 0226 IBIXK LIN LHR 01/01/04 06:20 01/01/04
08:35 01/01/04 06:25 "01/01/04 08:35
01/2004" AZ,,1384,IDAWF ,GOA,FCO,01/01/04 06:25,01/01/04
07:25,01/01/04 06:25,01/01/04 07:15

nel senso che quando mancando l'ultimo campo non viene messa la
virgola, la riga successiva viene importata per intero nell'ultimo
campo della riga precedente...

qualcuno sa spiegarmi perchè o gli è già capitato questo stesso
problema????

grazie mille... stefano...
Jul 20 '05 #1
3 4664
s.******@tin.it (STB) wrote in message news:<60******* *************** ****@posting.go ogle.com>...
Salve Ragazzi!!!
ho un problema che non riesco a risolvere e spero di riuscirci con il
vostro aiuto...
dunque..
ho un file csv tipo questo

Date,Aircarrier ,CallSign,ComFl tNbr,AcReg,AIPT Dep,AIPTDst,STD ,STA,AOBT,ATA,C ancellationDate
01/2004,AZ,,0735,I DATD ,SKG,MXP,01/01/04 04:20,01/01/04 06:45,01/01/04
04:20,01/01/04 06:28,
01/2004,AZ,,1712,I BIKA ,CTA,MXP,01/01/04 05:00,01/01/04 07:05,01/01/04
05:00,01/01/04 07:06
01/2004,AZ,,1176,I DAVR ,SUF,MXP,01/01/04 05:10,01/01/04 06:55,01/01/04
05:10,01/01/04 06:48,
01/2004,AZ,,1642,I DAVS ,BDS,MXP,01/01/04 05:15,01/01/04 06:55,01/01/04
05:15,01/01/04 06:51
01/2004,AZ,,1650,I DACX ,PSA,MXP,01/01/04 05:20,01/01/04 06:10,01/01/04
05:20,01/01/04 06:15,
01/2004,AZ,,1760,I DACV ,PMO,LIN,01/01/04 05:20,01/01/04 06:55,01/01/04
05:20,01/01/04 07:01,
01/2004,AZ,,1734,I BIKO ,CTA,FCO,01/01/04 05:25,01/01/04 06:45,01/01/04
05:35,01/01/04 06:52,

e lo importo con la bcp server.dbo.tabl e in file.csv -T -c -t, -r\n.

dunque cosa succede...
come avrete notato per il campo CancellationDat e il carattere di fine
riga coincide con il carattere che delimita il campo... che poi
sarebbe \n
dunque...se faccio una importazione da DTS con file type Text ANSI,
Row delimiter {CR}{LF} e text qualifier <none> tutto funziona molto
ok...
devo però importare file da posizioni diverse su disco e con nomi
diversi, quindi mi torna molto meglio usare da una stored procedure
master..xp_cmds hell @appo con @appo = 'bcp server.dbo.tabl e in
file.csv -T -c -t, -r\n'.
il problema è però che con questa importazione ho una situazione di
questo genere...

Date Aircarrier CallSign ComFltNbr AcReg AIPTDep AIPTDst STD STA AOBT ATA CancellationDat e
01/2004 AZ 0735 IDATD SKG MXP 01/01/04 04:20 01/01/04
06:45 01/01/04 04:20 01/01/04 06:28
01/2004 AZ 1712 IBIKA CTA MXP 01/01/04 05:00 01/01/04
07:05 01/01/04 05:00 01/01/04 07:06
01/2004 AZ 0226 IBIXK LIN LHR 01/01/04 06:20 01/01/04
08:35 01/01/04 06:25 "01/01/04 08:35
01/2004" AZ,,1384,IDAWF ,GOA,FCO,01/01/04 06:25,01/01/04
07:25,01/01/04 06:25,01/01/04 07:15

nel senso che quando mancando l'ultimo campo non viene messa la
virgola, la riga successiva viene importata per intero nell'ultimo
campo della riga precedente...

qualcuno sa spiegarmi perchè o gli è già capitato questo stesso
problema????

grazie mille... stefano...


If your DTS import works correctly, then one possibility is to change
the text filename in DTS dynamically:

http://www.sqldts.com/default.aspx?200

You could then run your DTS package from a stored procedure or some
other way:

http://www.sqldts.com/default.aspx?104

Simon
Jul 20 '05 #2
STB (s.******@tin.i t) writes:
Date Aircarrier CallSign ComFltNbr AcReg AIPTDep AIPTDst STD STA AOBT ATA CancellationDat e
01/2004 AZ 0735 IDATD SKG MXP 01/01/04 04:20 01/01/04
06:45 01/01/04 04:20 01/01/04 06:28
01/2004 AZ 1712 IBIKA CTA MXP 01/01/04 05:00 01/01/04
07:05 01/01/04 05:00 01/01/04 07:06
01/2004 AZ 0226 IBIXK LIN LHR 01/01/04 06:20 01/01/04
08:35 01/01/04 06:25 "01/01/04 08:35
01/2004" AZ,,1384,IDAWF ,GOA,FCO,01/01/04 06:25,01/01/04
07:25,01/01/04 06:25,01/01/04 07:15

nel senso che quando mancando l'ultimo campo non viene messa la
virgola, la riga successiva viene importata per intero nell'ultimo
campo della riga precedente...

qualcuno sa spiegarmi perchè o gli è già capitato questo stesso
problema????


Se ti comprendo correto, il problema è che l'ultimo campo si manca. In
questo case bisogna di usare un format file. Anché, bisogna sapere prima
di comminciare il importazione se il camp "canceldate " è nel file o no,
per sapere come invocare BCP.

If I understand you correctly, the problem is that the last column
is missing. In this case, you need to use a format file. Also, you need
to know prior starting the import whether canceldate is in the file or
note, to know how to invoke BCP.

--
Erland Sommarskog, SQL Server MVP, so****@algonet. se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #3
STB
sorry... i find the problem...
the origin is in a wrong convertion fron .xls file to .csv...

thank you for your time...

have a nice day...
Jul 20 '05 #4

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

Similar topics

19
14832
by: Thue Tuxen Sørensen | last post by:
Hi everybody ! I´m maintaining a large intranet (approx 10000 concurrent users) running on one IIS box and one DB box with sqlserver 2000. Currently there is 2,5 GB Ram, 1 1400 mhz cpu and 2 scsi disks installed on the db box. Sqlserver is set to use max 1,4 GB RAM, and the sqlserver does not seem to be using it all.
2
2133
by: Jay Chan | last post by:
We have just installed a SQL Server 2000 (SP 3A) onto a computer that has Windows-2003 Server on it. Now, we cannot get access to that database server from other computers. Seem like this may be an issue with Active Directory. Our network consists of Windows-2000 Servers (SP 4) and Windows-2000 workstations and Windows-XP workstations. We also have SQL Server 2000 (SP2) in three Windows-2000 servers. All work fine. Recently, we get a...
3
811
by: STB | last post by:
Salve Ragazzi!!! ho un problema che non riesco a risolvere e spero di riuscirci con il vostro aiuto... dunque.. ho un file csv tipo questo Date,Aircarrier,CallSign,ComFltNbr,AcReg,AIPTDep,AIPTDst,STD,STA,AOBT,ATA,CancellationDate 01/2004,AZ,,0735,IDATD ,SKG,MXP,01/01/04 04:20,01/01/04 06:45,01/01/04 04:20,01/01/04 06:28, 01/2004,AZ,,1712,IBIKA ,CTA,MXP,01/01/04 05:00,01/01/04 07:05,01/01/04
2
6726
by: Emiliano | last post by:
Ecco il mio problema:devo caricare in un database di sql delle tabelle presenti in file txt la query per caricarle potrebbe essere la seguente: create table prova( codice varchar(22), rowid varchar(10), data_open date,
0
2804
by: Chris Halcrow | last post by:
Hi I've spent ALL DAY trying to re-install SQL Server 2000 on Windows XP. I continually get the error 'cannot configure server' just at the end of the installation. I've tried the following: - Removing SQL server from 'Program Files' folder following an unsuccessful attempt to re-install, and entirely removing the registry entry 'HKEY_CURRENT_USER > SOFTWARE > Microsoft > MSSQLServer', as well as the corresponding entry under...
0
1045
by: Lou Amaro® | last post by:
salve a tutti, spero mi possiate aiutare su un tale applicativo/sistema (?) WINDOMINO. Ho un vecchio programma in Windomino i cui dati e struttura dovrei riportare in MS-Access, ma non trovo sulla rete info su Windomino (trovo solo siti spagnoli che parlano di giochi) fatemi qualsiasi cosa sappiate, grazie. Sab
1
2033
by: P. Marcello Genuini | last post by:
Salve a tutti, Premesso che sono alle prime armi con c#, spero qualcuno di voi possa aiutarmi in un questo mio problema. Stò scrivendo una repository di form in c# che dovrebbero essere poi usate da un team di sviluppatori per scrivere applicazioni, e quindi vorrei dotare le varie form padre di più funzionalità possibili per evitare che queste vengano demandate alle form figlie che ereditano da queste. Prendiamo una form classica di...
14
3025
by: Developer | last post by:
Hello All, i have recently installed VS2005 and was trying to install SQL sever 2000. I have Win XP' SP2. But when I tried installing, it only installed client tools and not the database. Can anyone please help me with this as I want to install SQL server and also wouold be grateful, if you can suggest me any workaround to dealwith this problem.(Like should I install any new OS etc). Any help would be appreciated.
2
1109
by: Luciano \(DOC\) | last post by:
Devo realizzare una specie di foglio dati dove l'utente possa riempire una serie di campi con dei valori ed aggiungere o eliminare righe intere. Mano mano che si inseriscono i dati devo visualizare alcuni calcoli fra le celle e gran finale il submit di tutto il pappone. Ho una mezza idea, tipo memorizzare i valori in una matrice mano mano che si inseriscono dati o righe e poi spararla intera al server. Suggerimenti? Saluti. Luciano
0
8462
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
8381
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
8893
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
8799
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...
0
7401
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...
0
4205
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4380
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2792
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2026
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.