Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
deanglen
Yak Posting Veteran
65 Posts |
Posted - 2013-01-07 : 14:51:31
|
HiWe have a SQL table in our CMS called customer.dboThis 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
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2013-01-07 : 15:09:01
|
If the req is that all the fields are nullDELETE FROM yourTableWHERE COALESCE(email, FirstName, LastName) IS NULLThis won't delete records that have an empty stringJimEveryday I learn something that somebody else already knew |
|
|
|
|
|