473,396 Members | 1,914 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,396 software developers and data experts.

Insert New Record Fails On Table With Unique Constraint

Hi,

I keep getting an error when I try to insert a new record into a table (SQL
2000) that has a column that I've configured as 'Unique Null Allowed'. I
used Visual Studio (2003) IDE SQL Data Adapter Wizard to create the stored
procedures, data adapter, and dataset using a simple select statement with
one paramater. Everything works fine except the 'Unique Null Allowed' column
requires a value on Insert or I get an error. What am I doing wrong?
Nov 17 '05 #1
4 1766
Make the column an identity column.

"Rich" wrote:
Hi,

I keep getting an error when I try to insert a new record into a table (SQL
2000) that has a column that I've configured as 'Unique Null Allowed'. I
used Visual Studio (2003) IDE SQL Data Adapter Wizard to create the stored
procedures, data adapter, and dataset using a simple select statement with
one paramater. Everything works fine except the 'Unique Null Allowed' column
requires a value on Insert or I get an error. What am I doing wrong?

Nov 17 '05 #2
Thanks for responding; I'm unable to change the column to an 'identity'
because two other columns are set as the primary key.

"carion1" wrote:
Make the column an identity column.

"Rich" wrote:
Hi,

I keep getting an error when I try to insert a new record into a table (SQL
2000) that has a column that I've configured as 'Unique Null Allowed'. I
used Visual Studio (2003) IDE SQL Data Adapter Wizard to create the stored
procedures, data adapter, and dataset using a simple select statement with
one paramater. Everything works fine except the 'Unique Null Allowed' column
requires a value on Insert or I get an error. What am I doing wrong?

Nov 17 '05 #3
Add an insert trigger to increment the value.

"Rich" wrote:
Thanks for responding; I'm unable to change the column to an 'identity'
because two other columns are set as the primary key.

"carion1" wrote:
Make the column an identity column.

"Rich" wrote:
Hi,

I keep getting an error when I try to insert a new record into a table (SQL
2000) that has a column that I've configured as 'Unique Null Allowed'. I
used Visual Studio (2003) IDE SQL Data Adapter Wizard to create the stored
procedures, data adapter, and dataset using a simple select statement with
one paramater. Everything works fine except the 'Unique Null Allowed' column
requires a value on Insert or I get an error. What am I doing wrong?

Nov 17 '05 #4
The value does not belong to me; it is user supplied.

"carion1" wrote:
Add an insert trigger to increment the value.

"Rich" wrote:
Thanks for responding; I'm unable to change the column to an 'identity'
because two other columns are set as the primary key.

"carion1" wrote:
Make the column an identity column.

"Rich" wrote:

> Hi,
>
> I keep getting an error when I try to insert a new record into a table (SQL
> 2000) that has a column that I've configured as 'Unique Null Allowed'. I
> used Visual Studio (2003) IDE SQL Data Adapter Wizard to create the stored
> procedures, data adapter, and dataset using a simple select statement with
> one paramater. Everything works fine except the 'Unique Null Allowed' column
> requires a value on Insert or I get an error. What am I doing wrong?

Nov 17 '05 #5

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

Similar topics

4
by: Randell D. | last post by:
Folks, I use PHP to write my form data to MySQL. I have a database with about ten tables. I'm trying to fill one table with some dummy data (its a contact manager table holding names of...
3
by: Suzanne | last post by:
Hi All I'm having problems getting my data adapter to throw a concurrency exception with an INSERT command. I want to throw a concurrency exception if an attempt is made to enter a row into...
10
by: florian | last post by:
Hi, we have a contention problem because of an application which tries to insert a duplicate row in a table with primary key. This insert fails of course but the locks are not released within...
6
by: Larry Johnson | last post by:
I have two similar SQL Server databases each with a table named Payments. PaymentID is an identity field and the primary, unique, key in both tables. There is one other key but it is not unique. ...
7
by: trint | last post by:
This: string strSQL2 = "INSERT INTO tblTravelDetailMember(memberId, " + " TravelDetailUplineId, " + " rankId, " + " TravelDetailId, " + " CreatedDateTime, " + " Operator) " + "VALUES ('" +...
2
by: D. Dante Lorenso | last post by:
I'm trying to build a table that will store a history of records by enumerating the records. I want the newest record to always be number ZERO, so I created a trigger on my table to handle the...
6
by: Tom Allison | last post by:
I seemed to remember being able to do this but I can't find the docs. Can I run a sql query to insert new or update existing rows in one query? Otherwise I have to run a select query to see if...
3
by: Bob Alston | last post by:
I have a routine to copy data to new versions of my app via insert into sql statements. Unfortunately, due to evolution of my app, sometimes the new version has more restrictive editing than an...
8
by: Mangler | last post by:
Can someone point me in the right direction on this? There are 3 fields in the DB: model, rma, bagqty. If the values on a certain row are I530, 1108, 50 and a user goes to input the same data I...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.