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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 deleting records referenced somewhere

Author  Topic 

sql_lover
Starting Member

14 Posts

Posted - 2007-03-20 : 00:48:30
i would like to delete a record that is not ref. somewere else

for eg. i want to delete a record of a city if it is not somewhere else.i am not actually deleting any record from any table of a db.instead i make it invisble to user that i keep a active flag which i set to false(at the time of deletion)

so in this case even if a city is ref somewhere it will allow me to delete (seting the active flag to false)

so what would be the solution to my problem

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2007-03-20 : 01:35:14
Just add the flag - it's a pretty standard solution. How you interpret it is up to you. You could consider changing the name of your table and creating a view of the same name as SELECT * from cities where deleted='N' which could either help or make things extremely complicated depending on what you are trying to achieve! Might get tangled up if you have referential integrity though. Like everything...it depends.
Go to Top of Page
   

- Advertisement -