Powershell – Concatenate files
Example: To concatenate all .txt files in directory C:\temp and store result in outfile.txt
Powershell – Recursive Search for Strings in Files
To search for a string (grep) in files recursively with Powershell (example): gci -recurse -include *.sql|%{gc $_} | %{$_|select-string “dba”} To get the filename(s): gci -recurse -include *.txt|%{$Filename=$_;gc $_} | %{$res=$_|select-string “dba”;if ($res) {Write-Host “$Filename”}}
SQL Server – Translate object_ids/object_names
— Get object_id from object name select OBJECT_ID(‘[dbo].[testobject]’) — get object_name from object id select OBJECT_NAME(213575799)
SQL Server – Display Running Tasks
Use this query in conjunction with sp_who to display running tasks and determine whether there are sessions blocking other sessions, and who is executing the query (sp_who) SELECT command, r.session_id, r.blocking_session_id, s.text, start_time, percent_complete, CAST(((DATEDIFF(s,start_time,GetDate()))/3600)…
Changing SQL Server Database Collation
See the article: http://sqlmag.com/database-performance-tuning/seven-step-process-changing-database-collation