|
|
Perl source Standalone Windows .exe, plus source
mssql_grep - print MS SQL Server 2000 tables/fields where the field value
matches a pattern and optionally search/replace
Author: Scott R. Keszler <keszler@srkconsulting.com>
Run `mssql_grep --help` for usage message.
usage: $basename -h host -d db -u user -p passwd
-t &| -v
-L &| -l "SQL like expression"
[-i] [-T] [-N] [-D] [-s] [-S] [-f file]
Required:
-h SQL Server hostname
-d database name
-u username (allowed to read host/database)
-p password
Use one or both:
-t seach tables
-v search views
Use one or both:
-L list all table and field names found, and distinct types
-l SQL "like" expression for which to search in fields
(use -l "%expression%" to find a substring)
(use \t for tab, \r for return, \n for newline)
Optional:
-i perform case-insensitive search
-T search text/ntext fields also (limited to first 65,535 characters)
-N search numeric fields also (cast as varchar)
-D search date/time fields also (cast as varchar)
-s search system tables/views only
-S search system tables/views also (overrides -s)
-f filename for results
-r search/replace search string (requires -R)
-R search/replace replace string (requires -r)
-I search/replace all-upper and all-lower case variants of -r and -R
Example:
mssql_grep -h hostname -d DBname -u username -p passwd -t -l "%search_string%" -I -T -r search_string -R replacement
|