50 lines
1.3 KiB
Markdown
50 lines
1.3 KiB
Markdown
# Verify – Compare Source and Target
|
||
|
||
The script `scripts/compare_source_target.sql` compares **structure and high-level consistency** between two databases without comparing row contents.
|
||
|
||
## What is compared
|
||
|
||
1. **Rowcounts per table**
|
||
2. **Columns**: datatype, length, nullable, collation
|
||
3. **Programmable objects**: views, stored procedures, functions (hash of definition)
|
||
4. **Triggers** (hash of definition)
|
||
5. **Users/Roles**: principals existence + role memberships
|
||
|
||
## How to run
|
||
|
||
1. Open `scripts/compare_source_target.sql` in SSMS
|
||
2. Set:
|
||
- `@SourceDb` (default: `sysdb_UTF8`)
|
||
- `@TargetDb` (default: `sysdb_utf8_jr`)
|
||
3. Execute.
|
||
|
||
## Output style (quick to read)
|
||
|
||
### Live messages (SSMS Messages tab)
|
||
|
||
You get a human-readable summary per step, e.g.:
|
||
|
||
- `ROWCOUNTS | SourceTables=... TargetTables=... TablesWithRowDiff=...`
|
||
- `COLUMNS | ColumnDiffs=...`
|
||
- `MODULES | Differences=...`
|
||
- `TRIGGERS | Differences=...`
|
||
- `PRINCIPALS | Differences=...`
|
||
- `ROLEMEMBERS | Differences=...`
|
||
|
||
At the end:
|
||
|
||
`COMPARE_DONE | RowDiffTables=... | ColumnDiffs=... | ...`
|
||
|
||
### Result sets (details)
|
||
|
||
If differences exist, result sets are shown for:
|
||
|
||
- Rowcount diffs
|
||
- Column diffs
|
||
- Module diffs
|
||
- Trigger diffs
|
||
- Principal diffs
|
||
- Role membership diffs
|
||
|
||
If a section has **no differences**, you’ll see an `..._OK` message and no detail list.
|