I'm working on an article and would appreciate some input.There are a few T-SQL commands that just write themselves on my keyboard. I almost don't have to type them, they just appear. I want to know what your queries are. What are the ones that you're typing over and over, all the time. I'm looking for DBA stuff, not just SELECT *. Don't worry if someone has already posted your common query. Post it again. I want to tabulate the most common ones to arrive at a list of between 10 and 20. Also, nothing proprietary. I love spBlitz/spWhoIsActive/Minion as much as the next person, but I'm just looking at the common T-SQL language and the DBAs job.Any five scripts or parts of scripts or statements. Shorter is better, but I'm interested in what it is that you can type fast because you know it because you've typed it a thousand times this week.As a starter, here are my five:[code="sql"]BACKUP DATABASE x TO DISK = 'E:\Backups\x.bak'WITH COPY_ONLY;RESTORE DATABASE y FROM DISK = 'E:\Backups\x.bak'WITH MOVE 'x_data' TO 'D:\data\y.mdf',MOVE 'x_log' TO 'L:\log\y_log.ldf';DBCC SHOW_STATISTICS ('dbo.Table','index');SELECT *FROM sys.dm_exec_requests AS derCROSS APPLY sys.dm_exec_query_plan(der.plan_handle) AS deqpCROSS APPLY sys.dm_exec_sql_text(der.sql_handle) AS dest;UPDATE STATISTICS dbo.Table Index WITH FULLSCAN;[/code]So, what are your five?
↧