SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Deleting anonymous customers
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

deanglen
Yak Posting Veteran

64 Posts

Posted - 01/07/2013 :  14:51:31  Show Profile  Reply with Quote
Hi

We have a SQL table in our CMS called customer.dbo

This table creates a permanant account for those customers who purchase from us but also creates a temporary one when a customer is on the site. We have a monthly maintenance that usually deletes this anon records but it no longer seems to be working.

There are fields that are given a NULL Value that are required when a customer purchases. Is there any SQL script that will delete these anon records from our SQL table (the fields for example are email, FirstName, LastName) so if these records are NULL what SQL script can I run to remove them?

jimf
Flowing Fount of Yak Knowledge

USA
2869 Posts

Posted - 01/07/2013 :  15:09:01  Show Profile  Reply with Quote
If the req is that all the fields are null

DELETE FROM yourTable
WHERE COALESCE(email, FirstName, LastName) IS NULL
This won't delete records that have an empty string


Jim

Everyday I learn something that somebody else already knew
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000