Hello -
I have given a task to create a script that checks SQL scripts for strings and will give me the list of sql scripts that have the strings detected.
Currently, my CheckScript is as follow:
Get-ChildItem "D:\IDs" -recurse | select name >> "D:\CheckDBScripts\Schema.txt"
Get-ChildItem "D:\IDs" -recurse | Select-String -pattern "DROP TABLE|SCHEMA" -exclude "DROP TABLE #[A-Z]" | group path | select name >> "D:\CheckDBScripts\Schema.txt"
But this doesn't work. Eventually, I would like to be able to search for Create, Alter, and excluding any temp table creation, deletion, and alteration.
Please advise.
Thank you!