Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 3 of 3

Thread: Help deleting customers

  1. #1
    jdrager is offline Junior Member
    Join Date
    Oct 2010
    Posts
    2

    Default Help deleting customers

    I would like to delete customers on multiple databases by specifying email field or just set the isadmin field to 0. I would do it manually but I have more than 200 databases to do this on and multiple customers to remove. I have been trying to write the SQL query incorporating the sp_msforeachdb but just cant get it to work I also have a query that sets isadmin to 0.
    Update dbo.Customer
    Set isAdmin = '0'
    Where Email = 'email@email.com'
    Any help on this would be greatly appreciated. Thanks!

  2. #2
    esedirect is offline Senior Member
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    343

    Default

    Never used that before; seems quite simple and dangerous! Perform this on a test server first!

    Code:
    EXEC sp_Msforeachdb "use [?];print '[?]';UPDATE Customer SET IsAdmin=0 WHERE Email = 'email@email.com'"
    http://www.esedirect.co.uk
    --------------------------------------------------------------------------
    Using MS 9.2.0.0 with the following customisations:

    Lightbox/Fancybox enlarged images;
    Auto-suggest searchbox;
    Extra product information shown only to our IP Address (such as supplier info, costs, etc.);
    Failed transactions emailed via trigger;
    Custom app to show basket contents when customer online;
    Orders pushed through to accounting systems.

    All the above without source!

  3. #3
    jdrager is offline Junior Member
    Join Date
    Oct 2010
    Posts
    2

    Default

    Quote Originally Posted by esedirect View Post
    Never used that before; seems quite simple and dangerous! Perform this on a test server first!

    Code:
    EXEC sp_Msforeachdb "use [?];print '[?]';UPDATE Customer SET IsAdmin=0 WHERE Email = 'email@email.com'"
    This worked for me thank you very much!
    Last edited by jdrager; 10-26-2010 at 01:09 PM.