Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6990945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:25:32+00:00 2026-05-27T19:25:32+00:00

We are moving our mysql database to strict_all_tables from non-strict mode and would like

  • 0

We are moving our mysql database to strict_all_tables from non-strict mode and would like to find all existing rows with invalid dates (0000-00-00) from all databases and tables on our server. Is there a way to do this by one command or some other simple way?

I would like to know database and table name where the 0000-00-00 value exists, column name would be a plus.

We have quite a large amount of databases with a large set of tables, some containing quite a large amount of data so the more automatic the method, the better.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:25:32+00:00Added an answer on May 27, 2026 at 7:25 pm
    #kedar.nitty-witty.com
    
    ## Table for storing resultant output
    DROP TABLE IF EXISTS `temp_details`;
    CREATE TABLE `temp_details` ( 
    `t_schema` varchar(45) NOT NULL,
    `t_table` varchar(45) NOT NULL,
    `t_field` varchar(45) NOT NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    
    
    
    ## Procedure for search in all fields of all databases
    DELIMITER $$
    #Script to loop through all tables using Information_Schema
    DROP PROCEDURE IF EXISTS get_table $$
    CREATE PROCEDURE get_table(in_search varchar(50))
    READS SQL DATA
    BEGIN
    DECLARE trunc_cmd VARCHAR(50);
    DECLARE search_string VARCHAR(250);
    DECLARE db,tbl,clmn CHAR(50);
    DECLARE done INT DEFAULT 0;
    DECLARE COUNTER INT;
    DECLARE table_cur CURSOR FOR
    SELECT concat('SELECT COUNT(*) INTO @CNT_VALUE FROM `',table_schema,'`.`',table_name,'` WHERE `', column_name,'` REGEXP "',in_search,'"') ,table_schema,table_name,column_name FROM information_schema.COLUMNS WHERE TABLE_SCHEMA NOT IN ('information_schema','test','mysql');
    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=1;
    #Truncating table for refill the data for new search.
    PREPARE trunc_cmd FROM "TRUNCATE TABLE temp_details;";
    EXECUTE trunc_cmd ; 
    OPEN table_cur;
    table_loop:LOOP
    FETCH table_cur INTO search_string,db,tbl,clmn;
    #Executing the search
    SET @search_string = search_string;
    ##SELECT  search_string;
    PREPARE search_string FROM @search_string;
    EXECUTE search_string;
    SET COUNTER = @CNT_VALUE;
    ##SELECT COUNTER;
    IF COUNTER>0 THEN
    # Inserting required results from search to table
    INSERT INTO temp_details VALUES(db,tbl,clmn);
    END IF;
    IF done=1 THEN
    LEAVE table_loop;
    END IF;
    END LOOP;
    CLOSE table_cur;
    #Finally Show Results
    SELECT * FROM temp_details;
    END $$
    DELIMITER ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am investigating moving our installer over to use InnoSetup and would like to
We are moving our database server to a bigger box. I have several databases
I'd like to start moving our application business layers into a collection of REST
We have a common problem of moving our development SQL 2005 database onto shared
I'm in the process of moving one of our projects from VS6 to VS2008
In our processing software we are moving from one version of an external assembly
We are considering moving the win32 build of our cross-platform C++ application from MS
We're looking into moving our application from VS2008 to VS2010. We generate some COM
We're using a simple File.Copy in C# for moving our database backups to extra
We are moving from Visual Sourcesafe to Subversion within our organisation. I am running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.