deanglen
Yak Posting Veteran
65 Posts |
Posted - 01/07/2013 : 14:51:31
|
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
2875 Posts |
Posted - 01/07/2013 : 15:09:01
|
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 |
 |
|