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
BEGIN | |
INSERT INTO @Projected (timeframe, Successes, Contacts) | |
(SELECT | |
P.timeframe | |
,SUM(Successes) AS 'Successes' | |
,SUM(Contacts) AS 'Contact' | |
FROM CalculatedData C | |
RIGHT JOIN @Projected P ON (P.timeframe = datediff(dd,AddedDate,GETDATE())) | |
GROUP BY p.timeframe, datediff(dd,AddedDate,GETDATE()) | |
) |
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 | |
DISTINCT P.timeframe | |
,* | |
FROM @Projected P | |
INNER JOIN ( | |
SELECT | |
s1.timeframe | |
,RunningTotal = (SELECT SUM(s2.Contacts) | |
FROM @Projected s2 | |
WHERE s2.timeframe <= s1.timeframe) |
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
/************************************************************* | |
Insert Timeframe 0 - 6 days into table variable. | |
*************************************************************/ | |
DECLARE @integer Int | |
DECLARE @Projected TABLE (timeframe CHAR(10)) | |
SELECT @integer = 0 | |
WHILE @integer < 7 | |
BEGIN | |
INSERT INTO @Projected(timeframe) |
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
BEGIN | |
SET NOCOUNT ON; | |
/************************************************************* | |
Insert Timeframe 0 - 6 days into table variable. | |
*************************************************************/ | |
DECLARE | |
@integer Int | |
DECLARE @Projected TABLE (timeframe CHAR(10), Successes INT, Contacts INT) |
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 | |
DECLARE @Today DATETIME | |
SELECT @Today = CAST(CONVERT(VARCHAR(10),GETDATE(),101) AS DATETIME) | |
/*Check to see if temp table exists in current connection*/ | |
IF OBJECT_ID('tempdb..#TEMP') IS NOT NULL DROP TABLE #TEMP | |
/*Determine all subscriptions that have errored or are pending.*/ | |
SELECT |
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 | |
/*Data Sources used in Reports*/ | |
SELECT | |
S.name AS 'Report Name' | |
,C.Name AS 'DataSource' | |
FROM dbo.[Catalog] S (NOLOCK) | |
INNER JOIN DataSource DS (NOLOCK) ON (s.ItemID = DS.ItemID) | |
INNER JOIN dbo.[Catalog] C (NOLOCK) ON (DS.Link = C.ItemID) | |
WHERE |
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
/*SQL 2000 Find Column*/ | |
SELECT | |
SO.NAME AS 'Table Name' | |
,SC.NAME AS 'Column Name' | |
,SM.TEXT AS 'Default Value' | |
FROM dbo.sysobjects SO (NOLOCK) | |
INNER JOIN dbo.syscolumns SC (NOLOCK) ON (SO.id = SC.id) | |
LEFT JOIN dbo.syscomments SM (NOLOCK) ON (SC.cdefault = SM.id) | |
WHERE | |
SO.xtype = 'U' |
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 @string VARCHAR(255) | |
SET @string='Insert String You Are Searching' | |
/*Drop temp table if already exists in connection.*/ | |
IF OBJECT_ID('tempdb..#data') IS NOT NULL DROP TABLE #data | |
/*Gather Data*/ | |
SELECT | |
DISTINCT | |
CASE sysobjects.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
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; | |
SELECT * FROM LinkedServer.Database.dbo.Table | |
--Set back to original isolation level. | |
SET TRANSACTION ISOLATION LEVEL READ COMMITTED; |
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 TABLE SubscriptionEmailList ( | |
RowID INT IDENTITY (1,1) | |
,ReportName VARCHAR(200) | |
,SubscriptionDescription VARCHAR(200) | |
,JobID VARCHAR(40) | |
,TO VARCHAR(4000) | |
,CC VARCHAR(4000) | |
,BCC VARCHAR(4000) | |
,ReplyTo VARCHAR(4000) | |
,IncludeReport VARCHAR(5) |
OlderNewer