Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Sybase > Foreign Key,on Delete

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-04-08, 13:21
dimis2500 dimis2500 is offline
Registered User
 
Join Date: Jan 2005
Posts: 337
Foreign Key,on Delete

I want to make a foreign key with 'on delete cascade' but there is an error.
How can I resolve that?
Reply With Quote
  #2 (permalink)  
Old 06-05-08, 06:36
Martijnvs Martijnvs is offline
Who? Me?
 
Join Date: Jan 2004
Location: The Hague/Utrecht, NL
Posts: 273
Can you post the error? We don't have any psychic powers, so resolving an unspecified error is a bit of a challenge
__________________
I'm not crazy, I'm an aeroplane!
Reply With Quote
  #3 (permalink)  
Old 06-05-08, 10:19
dimis2500 dimis2500 is offline
Registered User
 
Join Date: Jan 2005
Posts: 337
I write this code
Code:
alter table dimis.emp add constraint my foreign key (depno) REFERENCES dimis.dept (deptno) on delete cascade on update cascade
and the error is
Code:
Error: Incorrect syntax near the keyword 'on'.
Reply With Quote
  #4 (permalink)  
Old 06-06-08, 02:02
samirbadhe samirbadhe is offline
Registered User
 
Join Date: May 2008
Posts: 10
RE:Foreign Key,on Delete

I don't think 'on delete cascade' is supported by Sybase ASE. Rather you will have to use triggers, to achieve the 'on delete cascade' effect.
__________________
-samir
TechFruits.com
Reply With Quote
  #5 (permalink)  
Old 06-06-08, 07:02
Martijnvs Martijnvs is offline
Who? Me?
 
Join Date: Jan 2004
Location: The Hague/Utrecht, NL
Posts: 273
That is crrect. The create/alter-table command does not contain any option for specifying cascading deletes/updates. You can use a trigger for that.
__________________
I'm not crazy, I'm an aeroplane!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On