Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Madhavi.extarc
Starting Member
7 Posts |
Posted - 2014-04-25 : 09:39:44
|
ACADEMIC_YEAR COURSE_REFERENCE TERM ------------- ---------------- -------- 2014 -1465586182 TERM4 2014 -772484485 TERM4 With the above data, user must check and delete the row only if existI have query some thing like this:DELETE FROM epas_publish_course where COURSE_REFERENCE IN ( SELECT * FROM (SELECT COURSE_REFERENCE FROM epas_publish_course WHERE COURSE_REFERENCE) AS X) ; which deleting the complete table but i need to delete one particular row...Madhavi |
|
chbala85
Starting Member
49 Posts |
Posted - 2014-04-25 : 09:47:29
|
Hi,Please send more explanation.Thanks,krishna |
|
|
Madhavi.extarc
Starting Member
7 Posts |
Posted - 2014-04-25 : 09:50:50
|
from the above data for example if i want to delete the row with course ref -1465586182, one must check if the id exist in the table and delete the rowMadhavi |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2014-04-25 : 10:48:56
|
Why do you need to check for the existence of the row first? Is this for a class or something?There is no need to check, just delete. If you want to do something if no row is deleted, then you can check the @@ROWCOUNT and do something.DELETE epas_publish_course where COURSE_REFERENCE = -1465586182 |
|
|
|
|
|