Saturday, 2 July 2016
Tuesday, 21 June 2016
Simple SQL script for all tables
SELECT
'delete from ' + table_name
FROM
information_schema.tables
WHERE
table_name LIKE 'tbl_junk_%'
'delete from ' + table_name
FROM
information_schema.tables
WHERE
table_name LIKE 'tbl_junk_%'
Friday, 17 June 2016
Friday, 6 May 2016
Monday, 2 May 2016
Tuesday, 19 April 2016
Monday, 11 April 2016
Friday, 8 April 2016
Data reconciliation against SQL Servers
Requirement:
Compare two differently shaped data tables across two SQL Servers on a nightly basis.
Solution:
1. Create a view on each server that gets the data into a consistent (matching) shape. Use CAST to ensure the datatype also match:
2. Create a RedGate SQLDataCompare project that compares the two views:
3. Run a SQLDataCompare command nightly:
4. Which produces the following results:
In this case, 2 records were identical, two records were different and one record was found in "DB2" that didn't exist in "DB1".
Here is the summary and detail output, which is configurable from within your project file. I've opted to some identical records here, in production you probably wouldn't want to:
5. Email yourself the results
Compare two differently shaped data tables across two SQL Servers on a nightly basis.
Solution:
1. Create a view on each server that gets the data into a consistent (matching) shape. Use CAST to ensure the datatype also match:
2. Create a RedGate SQLDataCompare project that compares the two views:
3. Run a SQLDataCompare command nightly:
4. Which produces the following results:
In this case, 2 records were identical, two records were different and one record was found in "DB2" that didn't exist in "DB1".
Here is the summary and detail output, which is configurable from within your project file. I've opted to some identical records here, in production you probably wouldn't want to:
5. Email yourself the results
Wednesday, 6 April 2016
Thursday, 24 March 2016
Saturday, 13 February 2016
Sunday, 24 January 2016
Subscribe to:
Posts (Atom)