473,396 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SQL Server Delete

Hi All,

Sorry that I am Asking this question in this Group.

I have one doubt in SQL Server, Regarding how DELETE Works?

What is the Actual Thing that SQL Server Do when we delete any record from
the Database Table?
Does it maintain any Falg Internally or actually Delete the Record from
Database?
(Like In FoxPro It store some flag internally so that we can Undelete that
records).

Example, Suppose I have 2 tables of same structure, and I delete one record
from 1st table and put that record into 2nd table then how actually SQL
Server handles that. Does it really move that record or Does it changes the
pointer the record for 2nd table or mark the record for delete in 1st table
and create one record for 2nd table?
Can Any Body Help me in these DOUBTS?

Thanks
Prabhat
Nov 20 '05 #1
1 1408
When it deletes, it's gone.

If you need undelete functionality, wrap the transaction in a transaction,
i.e.
begin tran MyTranOfSomeNameNoteTheNameIsNotRequired
delete from table1 where...
if @@error <> 0
rollback tran
else
commit tran

If you need to remove a row from a table and also insert it in the second,
do the insert first, then the delete.
You can also write a trigger on the "to be deleted from" table and then
query the virtual table called DELETED for the row you just deleted and then
perform an insert to the new table.

But basically, there's no flag and it's not like foxpro.

hth
Eric
"Prabhat" <no********@hotmail.com> wrote in message
news:Ol**************@TK2MSFTNGP09.phx.gbl...
Hi All,

Sorry that I am Asking this question in this Group.

I have one doubt in SQL Server, Regarding how DELETE Works?

What is the Actual Thing that SQL Server Do when we delete any record from
the Database Table?
Does it maintain any Falg Internally or actually Delete the Record from
Database?
(Like In FoxPro It store some flag internally so that we can Undelete that
records).

Example, Suppose I have 2 tables of same structure, and I delete one record from 1st table and put that record into 2nd table then how actually SQL
Server handles that. Does it really move that record or Does it changes the pointer the record for 2nd table or mark the record for delete in 1st table and create one record for 2nd table?
Can Any Body Help me in these DOUBTS?

Thanks
Prabhat

Nov 20 '05 #2

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

Similar topics

15
by: MC | last post by:
I'm trying to use ASP pages generated in Frontpage to update an SQL server database. I can view information from the database but cannot update, I just get a message saying an error has occured. ...
2
by: Bob Ganger | last post by:
Hello, I am working on a project using SQL Server 2000 with a database containing about 10 related tables with a lot of columns containing text. The total current size of the database is about...
13
by: Jeager | last post by:
Why is it, Microsoft manage to write operating systems and office applications with every bell and whistle facility known to man. Yet, even after years and years of development they still cannot...
4
by: Madestro | last post by:
Hi guys, I am making a small program to retrieve e-mails from POP accounts. I got all the e-mail parsing stuff figured out, but I cannot seem to come up with a way to find out which e-mails are...
4
by: banz | last post by:
Hello I have a problem to resolve: I wrote a Perlscript which caches data from a server (local on my machine) I would like to have a other connection to a remote server but I don't know how to...
2
by: Bill | last post by:
Sorry re-posted as my email setting were wrong on the last post I wonder if anyone can help. I have a scheduled job running overnight to delete old records for a particular Db table. ...
5
by: Neil | last post by:
I am getting time-out errors when I try to perform a simple delete on a linked server. The command is: Delete From MyTable Where PKID=12345 I have tried executing this command directly from...
6
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...
2
by: Benzine | last post by:
I am running MS SQL 2000. I recently ran a procedure in Query Analyzer from the Master db to clear out all replication information so I could start/recreate it again. After I ran this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
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...

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.