This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --+---------------------------------------------------------------------------------------------------------------+-- | |
| --| Sync All Orphans in a Database | |
| --+---------------------------------------------------------------------------------------------------------------+-- | |
| select 'sp_change_users_login ''auto_fix'',''' + name + '''' + char(13) + char(10) + 'GO' | |
| from sysusers | |
| where sid NOT IN | |
| (select sid from master..syslogins ) | |
| AND | |
| islogin = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --+---------------------------------------------------------------------------------------------------------------+-- | |
| --| Sync an Orphan in all Databases | |
| --+---------------------------------------------------------------------------------------------------------------+-- | |
| SET NOCOUNT ON | |
| exec sp_MSforeachdb | |
| ' | |
| use ? | |
| select db_name() | |
| exec sp_change_users_login ''update_one'' , ''<login_name>'' , ''<login_name>'' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --+---------------------------------------------------------------------------------------------------------------+-- | |
| --| Get a Job-Hostory | |
| --+---------------------------------------------------------------------------------------------------------------+-- | |
| --| Date : 11:38 PM 9/10/2009 | |
| --| Purpose : Get a job history. Place the Job-name and get results soon. In some cases when you have a huge | |
| --| historical info, SSMS-Job history fails due to time-out - this batch could help you. | |
| --| Compatible : SQL Server 2000, SQL Server 2005 | |
| --+---------------------------------------------------------------------------------------------------------------+-- | |
| --| Author : Som Dutt Tripathi | |
| --+---------------------------------------------------------------------------------------------------------------+-- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SET ANSI_NULLS ON | |
| GO | |
| SET QUOTED_IDENTIFIER ON | |
| GO | |
| CREATE PROCEDURE [dbo].[psp_table_size_report] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SET ANSI_NULLS ON | |
| GO | |
| SET QUOTED_IDENTIFIER ON | |
| GO | |
| CREATE PROCEDURE [dbo].[psp_table_size_report] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SET ANSI_NULLS ON | |
| GO | |
| SET QUOTED_IDENTIFIER ON | |
| GO | |
| CREATE PROCEDURE [dbo].[psp_fragmentation_report] | |
| ( | |
| @recipients varchar(300), | |
| @subject varchar(800)='Fragmentation Report' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SET ANSI_NULLS ON | |
| GO | |
| SET QUOTED_IDENTIFIER ON | |
| GO | |
| CREATE PROCEDURE [dbo].[psp_disk_size_report] | |
| ( | |
| @threshold int=20, | |
| @recipients varchar(300), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SET ANSI_NULLS ON | |
| GO | |
| SET QUOTED_IDENTIFIER ON | |
| GO | |
| CREATE PROCEDURE [dbo].[psp_db_size_report] | |
| ( | |
| @threshold int=20, | |
| @recipients varchar(300), | |
| @subject varchar(800)='Database Size Report' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DECLARE @HowManyHoursAhead int | |
| Set @HowManyHoursAhead = 2; -- <-- Change the hour here. | |
| WITH OurJobs AS ( | |
| SELECT job.job_id, job.[name] | |
| , CASE job.[description] WHEN 'No description available.' THEN NULL ELSE job.description END AS Description | |
| , job.date_modified | |
| , CASE sched.next_run_date | |
| WHEN 0 THEN 'Never' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cls | |
| function setPrecision([Float]$number, [int]$precision ) | |
| { | |
| $prec="{0:N$precision}" | |
| $val=$($prec -f $number) | |
| return $val | |
| } |
NewerOlder