Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete record from the table
Message
From
12/02/2003 19:14:55
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00752409
Message ID:
00752566
Views:
21
This message has been marked as a message which has helped to the initial question of the thread.
>> Question: If we don't have the specific ItemID to delete, what would happen?

Why would you issue a delete against the table if you didn't have the ID of the row? Issuing a DELETE statement that does not remove any rows does not generate any errors from SQL.

>> And how do we know, if the record was deleted or we didn't have this record to start from?

Eric gave you the technical information. My questions is why would you want to know? If the row's not there, how do you have the ID to delete it with? If you're worried about concurrency, using the DELETE is a very expensive to find out - from a locking point of view. If you're really worried about it, you could do something like:
IF EXISTS (SELECT * FROM cartDetail WHERE itemID = @id) 
 DELETE FROM cartDetail WHERE itemID = @id
-Mike

>Hi everybody,
>
>strSql='delete from CartDetail where ItemID = '+cStr(intItemID)
>set conn = Server.CreateObject("ADODB.Connection")
>conn.open "connection string"
>conn.execute sql, , &H00000080
>
>Question: If we don't have the specific ItemID to delete, what would happen? And how do we know, if the record was deleted or we didn't have this record to start from?
>
>Thanks in advance.
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform