Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 13th, 2004, 08:41 PM
Authorized User
 
Join Date: Apr 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default importing from flat file PK problem

I am trying to import into sql server from a .csv flat file i made in excel. The problem is the Primary Key. It is set to auto increment.
When i leave an empty column i get:
"Directcopyxform conversion error:destination does not allow null"

when i just omit the column entirely, i get a wrong datatype error because it basically tries to copy all the columns 1 shift to the left

How am i supposed to represent and auto PK in .csv file

rrr
__________________
rrr
 
Old October 14th, 2004, 02:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

You cannot have EMTPY/NULL for that columns that is set as PRIMARYKEY. All Rows should contain values in it for primarykey column. Also ensure that you have set that up to ALLOW NULL for all other columns in the design veiw of the table on SQL server.

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old October 18th, 2004, 02:02 PM
Authorized User
 
Join Date: Apr 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

my intent is not to have Null value in primary key, the problem is the syntax to use in the .csv file. I have a .csv file that i need to insert into the table but the problem is that the primary key is set to auto incrememnt. for example

pk | col1 | col2
1 | a | a
2 | b | b

if i was to use this in my .csv file: "","c",c"" i get a NULL exception
I also cannot just leave out the column entirely: "c","c" or i will get a datatype exception cause it will try and copy it into the pk column,

any suggestions? is my only choice to manually insert the primary keys? that means i have to keep track of the current number everytime i want to import type a .csv file which will be imported and start from there


rrr
 
Old October 18th, 2004, 04:09 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

I would suggest you not to use IDENTITY/auto increment field for PK.

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
importing flat file into Access 2007 olgolg VBScript 0 March 29th, 2008 07:53 AM
Problem using positional flat file Sameer_Borikar Biztalk 0 March 3rd, 2005 08:11 AM
ComplexType Import Flat File Problem pn609 Biztalk 0 January 20th, 2005 10:10 AM
Problem importing text file manuel Access 3 April 7th, 2004 09:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.