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

deleting from a child table which have two parents

hi all,I'm doin a project with vb.net and sql as back end.i have a problem in deleting records from table.see i got a child table roommaintenance and two parent tables deptmaintenance,wardmaintenance the DDL for the tables are given below



CREATE TABLE deptmaintenance
(
departmentid varchar(10) NOT NULL ,
departmentname varchar(20) NULL ,
roomrate integer NULL ,
notes varchar(max) NULL
)
go



ALTER TABLE deptmaintenance
ADD CONSTRAINT XPKdeptmaintenance PRIMARY KEY CLUSTERED (departmentid ASC)
go


CREATE TABLE wardmaintenance
(
wardid varchar(10) NOT NULL ,
wardno integer NULL ,
departmentid varchar(10) NOT NULL ,
departmentname varchar(20) NULL ,
notes varchar(max) NULL
)
go



ALTER TABLE wardmaintenance
ADD CONSTRAINT XPKwardmaintenance PRIMARY KEY CLUSTERED (wardid ASC)
go

CREATE TABLE roommaintenance
(
roomid varchar(10) NOT NULL ,
roomno integer NULL ,
departmentid varchar(10) NULL ,
departmentname varchar(20) NULL ,
wardid varchar(10) NULL ,
wardno integer NULL ,
roomcost money NULL ,
notes varchar(max) NULL
)
go



ALTER TABLE roommaintenance
ADD CONSTRAINT XPKroommaintenance PRIMARY KEY CLUSTERED (roomid ASC)
go
ALTER TABLE roommaintenance
ADD CONSTRAINT R_3 FOREIGN KEY (departmentid) REFERENCES deptmaintenance(departmentid)
ON DELETE NO ACTION
ON UPDATE NO ACTION
go

right now i cant give "ON DELETE CASCADE" for roommaintenance table which is showing an error about some r5 constraint,but i dont want to CASCADE. what i want is if i delete from the child table it should not reflect in the parent tables. please help me on this
Jun 14 '10 #1
0 963

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Caroline | last post by:
I seem to always want to do this type of join, but I can never find how to do this. I am trying to join two tables. The parent table will always have one row of data and the child may have 0 to...
9
by: Bob C. | last post by:
I want to create a 1-many relationship. Parent table has a primary key, child table has no primary key. The child table does have an index with all four fields of the parent's PK. How can I do...
0
by: lanky_tx | last post by:
Hi All, I am trying to acess the rows within a child table of a windows form datagrid. I have tried using the CurrencyManager & BindingManagerBase to get the data but doesn't work. The...
1
by: Johann Blake | last post by:
I have a dataset that contains a parent table and a child table. A DataRelation exists between the two. I was under the impression from reading the VS docs that when I filled the parent table, the...
3
by: Bob Day | last post by:
Using VS 2003, VB.NET, SQL MSDE.. I am stumped. I have a datagrid with a parent/child relationship between two tables. If I add 200 rows from code in the same win form to the child table with...
8
by: Richard L Rosenheim | last post by:
I have a dataset containing a parent table related to a child table. The child table contains an ID field (which is configured as autonumber in the datatable), the ID of the parent, plus some...
5
by: PAUL | last post by:
Hello, I have 2 tables with a relationship set up in the dataset with vb ..net. I add a new record to the parent table then edit an existing child record to have the new parent ID. However when I...
11
by: Kay | last post by:
Hi all, I have populated a dataset with several tables, say - Roster, Agent and few more . The dataset is used to populated a listview with some shift info.. I think I'm sucessfully created a...
0
by: latin & geek via DotNetMonster.com | last post by:
hi! ok, im working on a database application. ive successfully managed to establish a relationship between two tables and display them on a datagrid, edit and add new records to them. now i...
4
by: G .Net | last post by:
Hi I have a DataSet with several DataTables. I have set up relations between these tables. I want to delete all the tables and re-fill them. However, when I try to do so, even after using...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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
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...

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.