473,387 Members | 1,440 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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,ComFltNbr,AcReg,AIPTDep,A IPTDst,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
05:00,01/01/04 07:06
01/2004,AZ,,1176,IDAVR ,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,IDAVS ,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,IDACX ,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,IDACV ,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,IBIKO ,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.table in file.csv -T -c -t, -r\n.

dunque cosa succede...
come avrete notato per il campo CancellationDate 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_cmdshell @appo con @appo = 'bcp server.dbo.table 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 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 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 4640
s.******@tin.it (STB) wrote in message news:<60**************************@posting.google. 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,ComFltNbr,AcReg,AIPTDep,A IPTDst,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
05:00,01/01/04 07:06
01/2004,AZ,,1176,IDAVR ,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,IDAVS ,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,IDACX ,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,IDACV ,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,IBIKO ,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.table in file.csv -T -c -t, -r\n.

dunque cosa succede...
come avrete notato per il campo CancellationDate 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_cmdshell @appo con @appo = 'bcp server.dbo.table 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 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 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.it) writes:
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 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
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...
2
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...
3
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 ...
2
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),...
0
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: ...
0
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...
1
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...
14
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...
2
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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...

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.