Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 17th, 2005, 12:02 PM
Alemus Alemus is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 3 Alemus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 43 sec
Reputation Power: 0
Problems with Identity auto-increment

I am attempting to load several SQL tables from an XML file.

In one of the sub-tables, the primary key is supposed to be an auto-generating number (Due to the lack of unique data). The Identity of this field is set to Yes and the auto-increment and seed are set to 1.

I am using a simple script to read the XML file into the table.
When I execute the script, I get an error that NULL values are not allowed in a key field. In other words, the auto-increment field isn't incrementing. The script will successfully load data from the same file into other tables in the DB.

The primary table is a Customer from the XML file. The customer has a unique key I can use for my customer table. This customer key is the foreign key in a phone table, where I am using the auto-increment primary key.

The XML file can return anywhere from zero to infinite phone numbers. It will allow duplicate numbers. This is why I'm not just using a combo of the phone number/customer ID as the key in the phone table.

Below is the script I am using:

set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkload.3.0")
objBL.ConnectionString = "provider=SQLOLEDB;data source=<anySource> ;database=<anyDB>;integrated security=SSPI"
objBL.ErrorLogFile = "c:\error.log"
objBL.Execute "c:\schema.xml", "c:\datafile.xml"
set objBL=Nothing

If it will help i can also psot the schema and datafile.

Any help figuring out why the auto-increment key isn't working would be appreciated

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Problems with Identity auto-increment


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT