Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete record from the table
Message
De
12/02/2003 19:14:55
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00752409
Message ID:
00752566
Vues:
26
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform