/*<OXADWDB>*/
/*req only on OXADWDB DB*/

/*updating value for datetime 1*/
drop table if exists #TEMP_tmp_update

<SEPARATEUR>
/*updating value for datetime to avoid 1900-01-01  2*/ 
select 'update '+TABLE_NAME+' set '+COLUMN_NAME+'=NULL where '+COLUMN_NAME+'=''19000101'' ' as req
,* 
into #TEMP_tmp_update
from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME like '%' and DATA_TYPE='datetime' and IS_NULLABLE='YES' 

DECLARE @Sql NVARCHAR(MAX);
DECLARE Cur CURSOR LOCAL FAST_FORWARD FOR 
    (SELECT req      FROM #TEMP_tmp_update  )

OPEN Cur
FETCH NEXT FROM Cur INTO @Sql

WHILE (@@FETCH_STATUS = 0)
BEGIN
    --Exec sp_executesql @Sql
	print @Sql
    EXEC ( @Sql )

    FETCH NEXT FROM Cur INTO @Sql 
END
CLOSE Cur
DEALLOCATE Cur; 