Click here to Skip to main content
15,894,405 members
Home / Discussions / Database
   

Database

 
SuggestionRe: Incorrect syntax near the keyword 'CROSS'. Pin
Richard Deeming23-May-16 2:02
mveRichard Deeming23-May-16 2:02 
QuestionError in MsHflexGrid for rowcolchange event Pin
srikrishnathanthri19-May-16 0:36
srikrishnathanthri19-May-16 0:36 
AnswerRe: Error in MsHflexGrid for rowcolchange event Pin
Simon_Whale19-May-16 0:40
Simon_Whale19-May-16 0:40 
AnswerRe: Error in MsHflexGrid for rowcolchange event Pin
Mycroft Holmes20-May-16 11:51
professionalMycroft Holmes20-May-16 11:51 
QuestionAuto update SQL table entries using foreign keys Pin
srikrishnathanthri16-May-16 21:50
srikrishnathanthri16-May-16 21:50 
AnswerRe: Auto update SQL table entries using foreign keys Pin
Richard Deeming17-May-16 1:26
mveRichard Deeming17-May-16 1:26 
GeneralRe: Auto update SQL table entries using foreign keys Pin
srikrishnathanthri17-May-16 2:04
srikrishnathanthri17-May-16 2:04 
GeneralRe: Auto update SQL table entries using foreign keys Pin
Richard Deeming17-May-16 2:15
mveRichard Deeming17-May-16 2:15 
srikrishnathanthri wrote:
Is it possible to set ''ON DELETE CASCADE" without adding primary key in the parent table ?

A foreign key must reference either a primary key, or a column with a unique constraint. To set up a foreign key between the tables, you'll need a unique constraint on the SLNO column in table1.

srikrishnathanthri wrote:
But I want to add "ON DELETE CASCADE" only for Place and State.

I don't think you've understood what ON DELETE CASCADE means. When you delete the row from table1, any rows in table2 with the same SLNO will be deleted as well. It doesn't do anything when you change a value in the referenced row, and it doesn't delete the value from specific columns.

Cascading Referential Integrity Constraints[^]


You could do this with a trigger[^] on table1, but it's a pretty nasty workaround, which can lead to hard-to-trace problems. As it's only two tables, it would be simpler to update both at the same time.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Auto update SQL table entries using foreign keys Pin
srikrishnathanthri17-May-16 2:40
srikrishnathanthri17-May-16 2:40 
GeneralRe: Auto update SQL table entries using foreign keys Pin
Richard Deeming17-May-16 2:43
mveRichard Deeming17-May-16 2:43 
GeneralRe: Auto update SQL table entries using foreign keys Pin
srikrishnathanthri18-May-16 1:33
srikrishnathanthri18-May-16 1:33 
GeneralRe: Auto update SQL table entries using foreign keys Pin
Richard Deeming18-May-16 1:40
mveRichard Deeming18-May-16 1:40 
AnswerRe: Auto update SQL table entries using foreign keys Pin
John C Rayan18-May-16 2:51
professionalJohn C Rayan18-May-16 2:51 
QuestionINSERT from SELECT into a variable Pin
Jassim Rahma15-May-16 6:05
Jassim Rahma15-May-16 6:05 
AnswerRe: INSERT from SELECT into a variable Pin
Kornfeld Eliyahu Peter15-May-16 6:59
professionalKornfeld Eliyahu Peter15-May-16 6:59 
GeneralRe: INSERT from SELECT into a variable Pin
Jassim Rahma15-May-16 10:29
Jassim Rahma15-May-16 10:29 
AnswerRe: INSERT from SELECT into a variable Pin
Kornfeld Eliyahu Peter15-May-16 19:23
professionalKornfeld Eliyahu Peter15-May-16 19:23 
GeneralRe: INSERT from SELECT into a variable Pin
Jassim Rahma15-May-16 23:57
Jassim Rahma15-May-16 23:57 
AnswerRe: INSERT from SELECT into a variable Pin
Sascha Lefèvre16-May-16 0:48
professionalSascha Lefèvre16-May-16 0:48 
QuestionHow to decide between mysql and SQL server? Pin
kmllev13-May-16 1:15
kmllev13-May-16 1:15 
AnswerRe: How to decide between mysql and SQL server? Pin
Eddy Vluggen13-May-16 2:09
professionalEddy Vluggen13-May-16 2:09 
GeneralRe: How to decide between mysql and SQL server? Pin
Richard Deeming13-May-16 2:13
mveRichard Deeming13-May-16 2:13 
GeneralRe: How to decide between mysql and SQL server? Pin
kmllev13-May-16 2:17
kmllev13-May-16 2:17 
QuestionRe: How to decide between mysql and SQL server? Pin
Eddy Vluggen13-May-16 3:42
professionalEddy Vluggen13-May-16 3:42 
AnswerRe: How to decide between mysql and SQL server? Pin
kmllev13-May-16 17:09
kmllev13-May-16 17:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.