473,659 Members | 2,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

on delete cascade problem

Hi all
I am trying to create a relation between two tables.

this is the sql statement in question

alter table T1
add constraint relation_T1_to_ T2
foreign key (T2_ID)
references T2 (ID) on delete cascade;

This relation is created fine if i execute the SQL statement using a
connection to the database.
but if i open the datbase in MSACCESS and open the query build, switch
to the sql view, and perform it, it complains about a syntax error at
the word "delete".

does anyone know why that is?

thanks
Nov 13 '05 #1
3 3168
hilz wrote:
Hi all
I am trying to create a relation between two tables.

this is the sql statement in question

alter table T1
add constraint relation_T1_to_ T2
foreign key (T2_ID)
references T2 (ID) on delete cascade;

This relation is created fine if i execute the SQL statement using a
connection to the database.
but if i open the datbase in MSACCESS and open the query build, switch
to the sql view, and perform it, it complains about a syntax error at
the word "delete".

does anyone know why that is?

thanks


no takers?
Nov 13 '05 #2
hilz wrote:
hilz wrote:
Hi all
I am trying to create a relation between two tables.

this is the sql statement in question

alter table T1
add constraint relation_T1_to_ T2
foreign key (T2_ID)
references T2 (ID) on delete cascade;

This relation is created fine if i execute the SQL statement using a
connection to the database.
but if i open the datbase in MSACCESS and open the query build, switch
to the sql view, and perform it, it complains about a syntax error at
the word "delete".

does anyone know why that is?

thanks

no takers?


I assume the back-end database is something like SQL Server?

Access SQL is slightly different to T-SQL, if you made your query a
"pass through" one it would probably work apart from the fact you
already created the constraint so it would probably complain about that :-)
Nov 13 '05 #3

"hilz" <no*@y.com> wrote in message
news:eUA8f.4995 $UM1.1460@duker ead10...
hilz wrote:
Hi all
I am trying to create a relation between two tables.

this is the sql statement in question

alter table T1
add constraint relation_T1_to_ T2
foreign key (T2_ID)
references T2 (ID) on delete cascade;

This relation is created fine if i execute the SQL statement using a connection to the database.
but if i open the datbase in MSACCESS and open the query build, switch to the sql view, and perform it, it complains about a syntax error at the word "delete".

does anyone know why that is?

thanks


no takers?


hilz,

You may not execute CASCADE clauses via MS Access Query Objects.

I *believe* you must use DAO and execute the SQL directly.
Sincerely,

Chris O.
Nov 13 '05 #4

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

Similar topics

1
8889
by: Andrew DeFaria | last post by:
I created the following .sql file to demonstrate a problem I'm having. According to the manual: If |ON DELETE CASCADE| is specified, and a row in the parent table is deleted, then InnoDB automatically deletes also all those rows in the child table whose foreign key values are equal to the referenced key value in the parent row. However:
3
3150
by: cfxchange | last post by:
I am looking into work-arounds for what seems to be a flaw, or "undocumented feature" of SQL Server replication and Instead of Delete triggers not playing together. It seems that if you want to use replication then you cannot use Instead Of triggers as it prohibits the replication triggers from firing. My delima is that I need to cascade delete, but first have the record and all child records inserted into associated delete tables...
2
11512
by: P.B. via SQLMonster.com | last post by:
I cannot execute my sql to create a table with ON DELETE CASCADE option. Here is my sql: CREATE TABLE Employees (Name Text(10) not null, Age number, CONSTRAINT pkEmployees PRIMARY KEY (Name)); <--- This is ok! CREATE TABLE CanTake (Name Text(10) not null, Make Text(10) not null, CONSTRAINT pkCanTake PRIMARY KEY (Name, Make),
8
7484
by: jim | last post by:
I have two tables that are related by keys. For instance, Table employee { last_name char(40) not null, first_name char(40) not null, department_name char(40) not null, age int not null, ... } Employee table has a primary key (combination of last_name and first_name).
9
10632
by: Robert Schneider | last post by:
Hi to all, I don't understand that: I try to delete a record via JDBC. But I always get the error SQL7008 with the error code 3. It seems that this has something to do with journaling, since the table from which I want to delete has two foreign keys that references two other tables and it is also referenced by another table. But this shouldn't be a problem, since I set the commit mode to none (or *none) at all places where this makes...
6
3095
by: Paul T. Rong | last post by:
Dear all, Here is my problem: There is a table "products" in my access database, since some of the products are out of date and stopped manufacture, I would like to delete those PRODUCTS from the table, but I was not allowed to do that, because "there are records related with those PRODUCTS in other tables (e.g. in table "ORDER_DETAIL").
3
2099
by: John Rivers | last post by:
Hello, I think this will apply to alot of web applications: users want the ability to delete a record in table x this record is related to records in other tables and those to others in other tables etc. in other words we must use cascade delete to do
14
5794
by: Karl O. Pinc | last post by:
Hi, Thought perhaps some other eyes than mine can tell if I'm doing something wrong here or if there's a bug somewhere. I've never passed a ROWTYPE varaible to a function but I don't see where the problem is. I keep getting errors like (the first is my debug output): NOTICE: last cycle is: 11 WARNING: Error occurred while executing PL/pgSQL function
6
3848
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called "Generations"), and it allows the user to add, edit and delete the various records of the table. "Generations" table has the following fields: "IDPerson", NamePerson", "AgePerson" and "IDParent". A record contains the information about a person (his name, his...
0
1654
by: Cirene | last post by:
Can you assist me with this database problem? I have 4 tables in my db.... Table1 (key: Table1Id) Table2 (key: Table2Id) Table3 (key: Table3Id) Table 4 has these fields: key: Table4Id Table1Id (ties it to Table 1)
0
8339
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,...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8751
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8535
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,...
0
8629
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5650
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();...
0
4176
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...
0
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1739
bsmnconsultancy
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...

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.