I'm trying to do multiple insert statements. The table looks like
this:
CREATE TABLE $table (CNTY_CNTRY_CD char(3),ST char(2),
CNTY_CNTRY_DESC R varchar(50),CNT Y_CNTRY_IND char(1),
HOME_CNTRY_IND char(1),
CONSTRAINT cnty_key PRIMARY KEY (CNTY_CNTRY_CD, ST))
I'm using 2 fields for the primary key constraint
My insert statement looks like this:
INSERT INTO $table
(CNTY_CNTRY_CD, ST,CNTY_CNTRY_D ESCR)
VALUES(?,?,?)
I've been through the list of values and none have both the same
CNTY_CNTRY_CD and ST and yet, this is the error message I'm getting:
DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver][SQL
Server]Vio
lation of PRIMARY KEY constraint 'cnty_key'. Cannot insert duplicate
key in obje
ct 'event_CNTY_CNT RY_CD'. (SQL-23000)
[Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been
terminated
.. (SQL-01000)(DBD: st_execute/SQLExecute err=-1)
Why is it looking for unique in just the one column instead of
referencing both? What do I need to do to get this to work? Help! 1 9891
"Cliff" <cl***@walkacro ssfire.com> wrote in message
news:54******** *************** ***@posting.goo gle.com... I'm trying to do multiple insert statements. The table looks like this:
CREATE TABLE $table (CNTY_CNTRY_CD char(3),ST char(2), CNTY_CNTRY_DESC R varchar(50),CNT Y_CNTRY_IND char(1), HOME_CNTRY_IND char(1), CONSTRAINT cnty_key PRIMARY KEY (CNTY_CNTRY_CD, ST)) I'm using 2 fields for the primary key constraint
My insert statement looks like this:
INSERT INTO $table (CNTY_CNTRY_CD, ST,CNTY_CNTRY_D ESCR) VALUES(?,?,?)
I've been through the list of values and none have both the same CNTY_CNTRY_CD and ST and yet, this is the error message I'm getting:
DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver][SQL Server]Vio lation of PRIMARY KEY constraint 'cnty_key'. Cannot insert duplicate key in obje ct 'event_CNTY_CNT RY_CD'. (SQL-23000) [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated . (SQL-01000)(DBD: st_execute/SQLExecute err=-1)
Why is it looking for unique in just the one column instead of referencing both? What do I need to do to get this to work? Help!
Why do you think it's only looking one column? The error says the object (ie
the table) is called "event_CNTY_CNT RY_CD", so perhaps you're confusing that
with the column "CNTY_CNTRY_CD" ? Or perhaps that wasn't the table name you
intended to use?
In any case, the error certainly indicates duplicate data - you could try
modifying your script to print out each INSERT statement for debugging
purposes, to be sure that you're really sending the values you think you
are. Or use Profiler to view the SQL sent to the server.
Simon This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gaz |
last post by:
Hi,
I need to have a table nested within another table. The tables are
alongside each other visually speaking, and the nested table (on the
right) can vary in size. My problem is that when the nested table has
more rows than the first table, the first table (on the left) pads out
its rows so that the table matches the height of the nested table.
I don't want this it happen.. I just want the nested table to be
longer than the first...
|
by: John A. |
last post by:
Hello all!
I've got a big bunch of pages using tables for layout. Eventually I'll
get them set up with more modernized code, but in the meantime I'd
like to slip in a little quick holiday decoration. I'd like to insert
a table cell with a fixed width (as much as such things can be fixed)
and a repeating garland background so as to show up along the left
side of the table, repeating down its length.
Our site has a couple thousand...
|
by: David Bradbury |
last post by:
I currently have an iframe on a webpage into which users can insert
content. They can further customise the text as I've included buttons
such as Bold, Italic, Bullet point etc. This is done along the lines
of
<td><div class="cbtn" onClick="cmdExec('bold',idContent)"
onmouseover="button_over(this);" onmouseout="button_out(this);"
onmousedown="button_down(this);" onmouseup="button_up(this);">
<img hspace="1" vspace=1 align=absmiddle...
|
by: Cylix |
last post by:
After search in the web,
I found that, insertRow, insertCell, is a bug of Mac IE,
Moreover, <table>, <tbody> seems doesn't support innerHTML,
What is the solution to show dynamic table in Mac IE?
Thank you
|
by: MayOng |
last post by:
Is it possible to insert a table or draw a table on rich text box like what ms word do? please give me some guideline, 10q :)
| |
by: quartz |
last post by:
Hello,
I have a txt file with names, years, days. How can I insert table using shell scripting???
Thenks a lot,
|
by: lxfc97 |
last post by:
Hi,
I'm trying to use the DOM to insert a TABLE into a DIV tag.
Can anyone tell me what I'm doing wrong here?
The code looks straightforward, but it is not working.
Thanks,
Dave
|
by: lenygold via DBMonster.com |
last post by:
Hi everybody:
What is the best way to
I have 10 tables with similar INSERT requiremnts.
INSERT INTO ACSB.VAATAFAE
WITH AA(AA_TIN, AA_FILE_SOURCE_CD, .AA_TIN_TYP) AS
( SELECT AA_TIN, AA_FILE_SOURCE_CD, .AA_TIN_TYP
FROM VAATAFAA
WHERE AB_TP_ACNT_STAT_CD <0),
|
by: =?Utf-8?B?ZndoaWx0b24=?= |
last post by:
Hi,
I have reference MSHTML.DLL. I can edit most of the WYSIWYG text when in
DesignMode (EditMode). That works fine
However, after reading an article on MSDN about the DHTML and TriEdit not
being safe for Vista...
How can I insert a table into the WYSIWYG mshtml control?
:)
|
by: visweswaran2830 |
last post by:
Hi,
I am having datagrid in that I have one column that should have table. Now I want to know that how can I include table in datagrid. My table values may differ from each rows in datagrid. So that also should be accomplished.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |