Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 7th, 2004, 03:37 PM
Chris@Home Chris@Home is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 Chris@Home User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Convert a SELECT into a DELETE statement

I need to convert this SELECT statement to a DELETE statement

SELECT CustId FROM Profile
WHERE CustId LIKE 'HEAT%'
AND CustId NOT IN
(SELECT CustId FROM CallLog)

Here is what I've come up with:

DELETE FROM Profile
WHERE CustId LIKE 'HEAT%'
AND CustId NOT IN
(SELECT CustId FROM CallLog)

Could someone please check if the DELETE statement looks correct, since I have no way of
testing it.

This statement is going to run on a database that contains about 1 million records.
It's going to delete about six thousand records. My question: is a simple DELETE statement
such as this one going to do the job, or do I have to formulate a more complex DELETE
statement?

Could someone please help me? It would be very much appreciated. Thank you.

Reply With Quote
  #2  
Old March 8th, 2004, 02:50 AM
Kris_Vanherck's Avatar
Kris_Vanherck Kris_Vanherck is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Belgium, Antwerp
Posts: 177 Kris_Vanherck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 24 sec
Reputation Power: 5
i parsed it with query analyzer:

"The command(s) completed successfully."

although i would advise you to backup the db before running it
ask your db admin for when the next backup will be

and to answer your question: you would be suprised at how effective simple sql statements are

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Convert a SELECT into a DELETE statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT