This file contains 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
CREATE FUNCTION [dbo].[CamelCase] | |
( | |
@Str VARCHAR(8000) | |
) | |
RETURNS VARCHAR(8000) | |
AS | |
BEGIN | |
DECLARE @Result VARCHAR(2000) | |
SET @Str = LOWER(@Str) + ' ' | |
SET @Result = '' |
This file contains 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
SELECT | |
'ALTER SCHEMA NewSchemaName TRANSFER [' + SysSchemas.Name + '].[' + DbObjects.Name + '];' | |
FROM sys.Objects DbObjects | |
INNER JOIN sys.Schemas SysSchemas | |
ON DbObjects.schema_id = SysSchemas.schema_id | |
WHERE SysSchemas.Name = 'OldSchemaName' | |
AND (DbObjects.Type IN ('U', 'P', 'V')) |
This file contains 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
USE [ReportServer]; -- You may change the database name. | |
GO | |
SELECT USR.UserName AS SubscriptionOwner | |
,SUB.ModifiedDate | |
,SUB.[Description] | |
,SUB.EventType | |
,SUB.DeliveryExtension | |
,SUB.LastStatus | |
,SUB.LastRunTime |
This file contains 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 @DBInfo TABLE | |
( ServerName VARCHAR(100), | |
DatabaseName VARCHAR(100), | |
DbSize VARCHAR(100), | |
SpaceUsed VARCHAR(100), | |
SpacePercentFree VARCHAR(100), | |
LogSize VARCHAR(100) | |
) | |
DECLARE @command VARCHAR(5000) |
This file contains 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
SELECT | |
CONVERT(CHAR(100), SERVERPROPERTY('Servername')) AS Server, | |
msdb.dbo.backupset.database_name, | |
msdb.dbo.backupset.backup_start_date, | |
msdb.dbo.backupset.backup_finish_date, | |
msdb.dbo.backupset.expiration_date, | |
CASE msdb..backupset.type | |
WHEN 'D' THEN 'Database' | |
WHEN 'L' THEN 'Log' | |
END AS backup_type, |
This file contains 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
USE MSDB | |
GO | |
SELECT | |
sj.job_id as JobId, | |
sj.name as JobName, | |
sjs.step_name as StepName, | |
sjs.Command as Command | |
FROM sysjobs sj | |
INNER JOIN sysjobsteps sjs | |
ON(sj.job_id = sjs.job_id) |
This file contains 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
WITH XMLNAMESPACES | |
-- XML namespace def must be the first in with clause. | |
( | |
DEFAULT | |
'http://schemas.microsoft.com/sqlserver/reporting/2006/03/reportdatasource' | |
, | |
'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner' | |
AS rd | |
) | |
,SDS |
This file contains 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
WITH Packages | |
AS ( | |
SELECT DISTINCT CAST([parameter_value] AS VARCHAR(1000)) AS Parameter_value | |
,ei.package_name | |
,ei.project_name | |
,ei.folder_name | |
FROM [SSISDB].[internal].[execution_parameter_values] v | |
INNER JOIN SSISDB.internal.execution_info ei | |
ON ei.execution_id = v.execution_id | |
WHERE parameter_name Like '%Connection%' |
This file contains 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
exec sp_MSForEachDB | |
' | |
USE ? | |
SELECT DISTINCT | |
o.name AS Object_Name, | |
o.type_desc, | |
m.definition | |
FROM sys.sql_modules m | |
INNER JOIN sys.objects o | |
ON m.object_id = o.object_id |
This file contains 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
USE [DatabaseName] | |
GO | |
/****** Object: UserDefinedFunction [dbo].[udf_List2Table] Script Date: 8/15/2013 2:09:47 PM ******/ | |
SET QUOTED_IDENTIFIER ON | |
GO | |
ALTER FUNCTION [dbo].[udf_List2Table] | |
( | |
@List VARCHAR(5000), | |
@Delim CHAR |
NewerOlder