cascading delete

This is a multi-part message in MIME format.

------=_NextPart_000_000A_01C0C26F.36B25870
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

    I'm using SYBASE Server 11 and Powerbuilder 7.02.  I'm having =
problems with a trigger on a parent child relationship of two tables, =
FISH_TBL and FISH_LEN_TBL, with a foriegn key constraint on FISH_LEN_TBL =
using the primary key, FISH_ID from FISH_TBL. =20

    To allow users to Delete a FISH_TBL record I have a trigger on =
delete for FISH_TBL that will delete all length records in the =
FISH_LEN_TBL.

create trigger delete_fish
on fish_tbl
for delete
as=20
delete fish_len_tbl from fish_len_tbl, deleted=20
where fish_len_tbl.fish_id =3D deleted.fish_id;

    that is generating an error.

    Dependent foreign key constraint violation in a referential =
integrity constraint.

    My DBA is telling me that if I want to be able to cascade delete =
child records using this trigger I need to remove Primary - Foriegn key =
and use triggers for referential integrity.  Is this true?  This example =
is straight from my SQL reference.  I can't believe it's necessary to =
remove the key.  Please someone help me.

Thank you for your advice.

Sincerely,


Adrian Edmundson

------=_NextPart_000_000A_01C0C26F.36B25870
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2920.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; I'm using SYBASE =
Server 11 and=20
Powerbuilder 7.02.&nbsp; I'm having problems with a trigger on a parent =
child=20
relationship of two tables, FISH_TBL and FISH_LEN_TBL, with a foriegn =
key=20
constraint on FISH_LEN_TBL using the primary key, FISH_ID=20
from&nbsp;FISH_TBL.&nbsp; </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; To allow users to =
Delete a=20
FISH_TBL record I have a trigger on delete&nbsp;for FISH_TBL that will =
delete=20
all length records in the FISH_LEN_TBL.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#ff0000 face=3DArial size=3D2>create trigger =
delete_fish<BR>on=20
fish_tbl<BR>for delete<BR>as <BR>delete fish_len_tbl from fish_len_tbl, =
deleted=20
<BR>where fish_len_tbl.fish_id =3D deleted.fish_id;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; that is generating =
an=20
error.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; <FONT =
color=3D#ff0000>Dependent=20
foreign key constraint violation in a referential integrity=20
constraint.</FONT></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; My DBA is telling me =
that if I=20
want to be able to cascade delete child records using this trigger I =
need to=20
remove Primary - Foriegn key and use triggers for referential =
integrity.&nbsp;=20
Is this true?&nbsp; This example is straight from my SQL =
reference.&nbsp; I=20
can't believe it's necessary to remove the key.&nbsp; Please someone =
help=20
me.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thank you for your advice.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Sincerely,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Adrian =
Edmundson</FONT></DIV></BODY></HTML>

------=_NextPart_000_000A_01C0C26F.36B25870--

0
Adrian
4/11/2001 3:07:28 PM
sybase.powerbuilder.database 9855 articles. 2 followers. Follow

0 Replies
400 Views

Similar Articles

[PageSpeed] 2

Reply:

Similar Artilces:

Cascading deletes - Which is better
I need to implement my cascading deletes on a SQL database.  Is it better (performance/reliablility-wise) to use the Foreign Key Cascading Deletes or to just write my own triggers to do the deletes?I was hoping someone had experimented and found which works best. DRI(declarative referential integrity) triggers are used when Cascade Deletes and Updates cannot be implemented in the RDBMS(relational database management system) as in SQL Server 7.0 and below.  In SQL Server 2000 using Cascade Delete and Cascade Update is the way to go.  The reason is reliability related because ...

Cascading delete in UltraLite database?
Hi, Does cascading delete work in ultralite database? I have a parent and a child table linked by a key. When I tried to delete a record from a parent table, it gave me error # 198 Primary Key Value Ref. My UltraLite database is based on a SQL Anywhere database. The two tables are set up so that when a record is deleted from a parent, the corresponding records in child table get automatically deleted. I am using SQL Anywhere/UltraLite 8.0.2.4285 and AppForge MobileVB 3.5.0. Thank you, -- Posted via http://dbforums.com mct79c <member33265@dbforums.com> wrote i...

Deleting SQL Anywhere database from PowerBuilder
Hi, From within a PowerBuilder application, I am trying to delete the database and then copy an empty database to it. This is because the database just gets bigger and bigger with each refresh of the data. I've tried using the PowerBuilder "FileDelete" command but that's not working. Then, I tried running an ISQL DBERASE command, but that keeps prompting me for the userid/pwd. Any other ideas? I would unload it, create a blank one, and then load it from the unload file. If you don't know the user id and password, how are you going to create a...

Deleting SQL Anywhere database from PowerBuilder
Hi, From within a PowerBuilder application, I am trying to delete the database and then copy an empty database to it. This is because the database just gets bigger and bigger with each refresh of the data. I've tried using the PowerBuilder "FileDelete" command but that's not working. Then, I tried running an ISQL DBERASE command, but that keeps prompting me for the userid/pwd. Any other ideas? I would unload it, create a blank one, and then load it from the unload file. A SQL Anywhere .DB file gets marked "read only" so you might have to ...

Deleting SQL Anywhere database from PowerBuilder
Hi, From within a PowerBuilder application, I am trying to delete the database and then copy an empty database to it. This is because the database just gets bigger and bigger with each refresh of the data. I've tried using the PowerBuilder "FileDelete" command but that's not working. Then, I tried running an ISQL DBERASE command, but that keeps prompting me for the userid/pwd. Any other ideas? I would unload it, create a blank one, and then load it from the unload file. If you don't know the user id and password, how are you going to create a...

DataSet rows being deleted, but after the update , the sql database is not updated. The delete rows still in the database.
 Stepping thru the code with the debugger shows the dataset rows being deleted.   After executing the code, and getting to the page presentation. Then I stop the debug and start the page creation process again ( Page_Load ).    The database still has the original deleted dataset rows. Adding rows works, then updating works fine, but deleting rows, does not seem to work.   The dataset is configured to send the DataSet updates to the database. Use the standard wizard to create the dataSet.     cDependChildTA.Fill(cDependChildDs._ClientDependentC...

Delete all databases from Database Explorer
 Hi,       I delete all databases from Database Explorer but when I open again the instance of VWD2005, the database is still present.     Do I have to delete them physically, or Database Explorer means something when I hit delete? cheers,imperialx     Hi, Make sure you have permissions on the account you use to delete databases. Did you get any error while deleting it?   HTH,Suprotim Agarwal -----http://www.dotnetcurry.com-----  ASP.NET Grid With Excel Capabilities...

Foreign Key Ultralite Database CASCADE delete and Update
This is a multi-part message in MIME format. ---=_forums-1-dub40929294 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit hello, I got two ultralite tables (Athletes and Penalties), In table ATHLETES i got the primary key (ID) and in the table PENALTIES i got the foreign key (ID) related to the primary key (ID) on table ATHLETES,.., in the Ultralite Schema Painter i can defined the foreign key but i cannot defined the cascade delete and update for this foreign key, how can i do it? In ASA you can defined the cascade delete and update for a...

How to delete damaged/deleted iFolders from database
Hi, I have an issue where we had something go wrong with a user's iFolder and an admin went in and deleted the actual directory of the iFolder under /simias/SimiasFiles/06/ (it's a long alphanumeric directory name). I just want to delete it out of the admin web page, but every time I try to connect to it, I get "Error: Unable to connect to the iFolder server." at the top of the page for that folder. I tried re-creating the directory /simias/SimiasFiles/06/68f1e735-f28b-40f8-b852-6f8c20995c8d/ifolder but that didn't help. Similarly, I'd like to ...

Consolidated deleted record not deleted from UltraLite database.
This is a multi-part message in MIME format. ------=_NextPart_000_001B_01C11683.A20EF2A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Consolidated deleted record not deleted from UltraLite database. As a test, I deleted the record with an ID=3D5 from the consolidated = database. I then deleted the record with an ID=3D6 from the UltraLite = database. After synchronization the record wit ID=3D6 was gone from both = databases. The record with an ID=3D5 was still on the UltraLite = database. I then updated the record with an ...

Delete file from server when database instance is deleted
I am working on an application with a main database table and an image table. Users can add a record to the image table with a file some text boxes and an image upload control. The image upload control places a file on the server and the image table records the url of the file.My problem is, when the record is deleted from the table I can't get the corresponding file on the server deleted. I know somehow I have to get the url from the database while its deleting and use the system.io class to delete the file, but I don't know how to convert my imageurl field of my table converted into a vari...

Version of PowerBuilder (ref: Creating database for PowerBuilder)
I'm using PowerBuilder v8.0 and would like to create a notification system for my practiculum project. I'd like to use Access to create the database. Please enlighten me on what should I create (e.g. tables, queries) for the usage of it. Thank You. Regards, Yang Ashra Don't double post, it's bad etiquette. Unless you have a very good reason to do so, we recommend you don't use Access. Use SQL Anywhere instead - it's more stable - and a far better database in my opinion. PowerBuilder (enterprise) supports just about every database out there, so if you...

Deleting from database through data adapter is not being affected in database
 good evenning all,I am trying to delete the row from database but its not working.code is hereSqlConnection con = new SqlConnection("initial catalog=gaurav;data source=LABPC1;uid=sa;pwd=aspire");DataSet ds = new DataSet();SqlDataAdapter sda;     private void button2_Click(object sender, EventArgs e)        {            for (int i = 0; i < ds.Tables["stu"].Rows.Count; i++)            {    &nb...

Delete (Hide) Row from Gridview without deleting from DataBase
I am populating some data in a GridView.I added a column with a checkbox.Now I want to generate a sort of print-preview...When Ich check some buttons and hit my printpriview button. I only want these (selected rows displayed).How can I do this?The checkbox thing is already working What I basically need is something to delete data temporaly from a GridView (not Database).I tryed GridViewRow.Dispose() which worked but then the paging was still implementet and the user sees still all pages =(I have tryed GridViewRow.Enabled = false which only turned the colors =(I have used GridViewRow.Visible ...

When I delete something in my GridView, my data is delete in the database but not on my GridView
I've got a GridView, when I click on the delete button, my data is deleted in the database but not on my GridView. When I press on F5 for refresh my browser, my datarow is deleted. So is it possible the clear the cache of the GridView ? Or is there an other solution for this problem ? Kind Regards,Joeri Pansaerts.From Bruges, Belgium :) rebind your gridview... Regards,MhaeyPlease remember to click “Mark as Answer” on the post that helps you.. =) darkcat02: rebind your gridview...  rebinding is the process u have to do if u re manually binding to the gridview. in case ...

Web resources about - cascading delete - sybase.powerbuilder.database

Cascading Style Sheets - Wikipedia, the free encyclopedia
Cascading Style Sheets ( CSS ) is a style sheet language used for describing the presentation semantics (the look and formatting) of a document ...

Ads API Profile: Alchemy’s Cascading Ad Creation, Analytics, and Auto-Optimization
Facebook’s performance advertising system provides buyers with a wealth of targeting options, but not the depth of control or analytics to effectively ...

Twitter blames global outage on 'cascading bug'
AFTER nearly a year without any significant periods of downtime, using Twitter was almost nothing like the early days of being on the service. ...

In defence of Gen Y, and cascading generations, by a boomer
Some accuse Generation Y of feeling entitled, overly precocious, demanding and rude but that doesn't necessarily reflect reality.

In defence of Gen Y, and cascading generations, by a boomer
Some accuse Generation Y of feeling entitled, overly precocious, demanding and rude but that doesn't necessarily reflect reality.

Cascading Style Sheets - 9to5Mac
Adobe announced updates on Thursday to many of its HTML5 design tools for Creative Cloud users. Among the updates, we get new features for Edge ...

West Texas Cascading Safety Failure
In the interests of Calamity Fairness, here’s a most depressing Bloomberg article : Texas Explosion Seen as Sign of Weak U.S. Oversight The ...

Watch this captivating video of 11,000 marbles cascading down a marble run
Everyone has a hobby. Some people like to play recreational sports, others prefer to go fishing, but did you know there are creative types out ...

Austria Announces Fence With Slovenia; Irony of German Whine; Cascading Fences; Mish Proposed Strategy ...
Two months ago, Austria's chancellor Werner Faymann criticized Hungary for building a fence along its border. Faymann proclaimed "To think that ...

Cascading Slopes is Jacob from The Drums' new band, NYC residency this month
Cascading Slopes at Cameo, 1/31/2013 (via @FreshBread) Cascading Slopes is a new project from Jacob Graham of The Drums. Unlike his other band, ...

Resources last updated: 12/30/2015 4:24:28 AM