Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BULK INSERT Problem
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 6.5 and older
Divers
Thread ID:
01357193
Message ID:
01357519
Vues:
24
Actually I just realized that I think I missed some columns in the CREATE TABLE, so the data in those column(s) is ending up in the Source_File, and is probably overflowing it.




>Kevin,
>
>If each line of your file doesn't end with ^^ to mean empty last column then bulk insert won't work. If that column isn't supplied you'd be better off creating a #temp table that matches the structure of the file, bulk inserting into it and then use an insert - select into the real table
>
>
>create table #x... 
>bulk insert into #x...
>insert into PartsMaster
>   select *, 'prg_old_3000 server.txt'
>      from #x
>
>
>>I'm not doing an insert into the column, I'm doing an update (below the BULK INSERT command).
>>The name I'm trying to add to the row is 23 characters long.
>>
>>
>>
>>>It looks like the values you're trying to insert into Source_File column are longer than 50 characters.
>>>
>>>>I have the following:
>>>>
>>>>DROP TABLE PartsMaster
>>>>
>>>>CREATE TABLE PartsMaster
>>>>( 
>>>>    Product_Series		VARCHAR(75), 
>>>>    Product_Number		VARCHAR(25), 
>>>>    Product_Name		VARCHAR(75),
>>>>    Part_Number			VARCHAR(50),
>>>>    Category			VARCHAR(50),
>>>>    Keyword			VARCHAR(50),
>>>>    Part_Description	        TEXT,
>>>>    Description			TEXT,
>>>>    New_part_Number		VARCHAR(25),
>>>>    Source_File			VARCHAR(50)
>>>>)
>>>>
>>>>DELETE FROM PartsMaster
>>>>
>>>>BULK INSERT PartsMaster 
>>>>     FROM 'D:\Projects\Clients\Abtech\Parts List\Data\Source\prg_old_3000 server.txt' 
>>>>    WITH 
>>>>    ( 
>>>>        FIELDTERMINATOR = '^', 
>>>>        ROWTERMINATOR = '\n' 
>>>>    )
>>>>
>>>>UPDATE PartsMaster SET Source_File = 'prg_old_3000 server.txt' WHERE Source_File = ''
>>>>
>>>>
>>>>If I leave the 'Source_File' off the CREATE TABLE command and don't try to update the source file name, this all works fine. If I include the source file, SQL errors with
>>>>"Bulk load data conversion error (truncation) for row 1, column 10 (Source_File)."
>>>>
>>>>There are multiple lines of the same error, each with varying line numbers.
>>>>
>>>>Anyone know what I'm doing wrong?
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform