Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
using System.Collections.Specialized;
using System.Configuration;
namespace ExecuteSSIS
string pkgLocation;
Package pkg;
Application app;
DTSExecResult pkgResults;
MyEventListener eventListener;
//Variables vars;
string appDirectory = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().Location.ToString());
//讀取封裝組態檔案
XDocument pkgxdc = XDocument.Load(string.Format(@"{0}\Package.dtsConfig", appDirectory));
//簡訊王發送Function
private string SendInTime(string userid, string pwd, string dstanumber, string smsbody)
{
Encoding myenc = Encoding.GetEncoding("big5");
string smsurl =
string.Format(@"http://202.39.48.216/kotsmsapi-1.php?username={0}&password={1}&dstaddr={2}&smbody={3}"
, userid, pwd, dstanumber, HttpUtility.UrlEncode(smsbody, myenc));
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(smsurl);
req.Method = "GET";
StringBuilder restoresql = new StringBuilder();
string GetFileDateFormat = Dts.Variables["FileDateFormat"].Value.ToString();
if (string.IsNullOrEmpty(GetFileDateFormat))
{
Dts.Log("FileDateFormat is null", 0, null);
Dts.TaskResult = (int)ScriptResults.Failure;
return;
}
string assemblyFolder = Directory.GetCurrentDirectory();
if (string.IsNullOrEmpty(assemblyFolder))
truncate table rsa241
CREATE TABLE [dbo].[rsa241](
[num] [int] NOT NULL,
[stime] [nchar](8) NOT NULL,
[event_code] [nvarchar](4) NULL,
[event_des] [nvarchar](50) NULL,
[event_card] [nvarchar](10) NULL,
[door_name] [nvarchar](20) NULL,
[device_id] [nvarchar](20) NULL,
[site_id] [nvarchar](12) NULL,
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="ProductsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MyOLAP %>"
ProviderName="<%$ ConnectionStrings:MyOLAP.ProviderName %>" SelectCommand="WITH&#13;&#10;MEMBER [Measures].[ParameterCaption]&#13;&#10;AS '[Dim Product].[English Product Name].CURRENTMEMBER.MEMBER_CAPTION'&#13;&#10;MEMBER [Measures].[ParameterValue]&#13;&#10;AS '[Dim Product].[English Product Name].CURRENTMEMBER.UNIQUENAME'&#13;&#10;SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue]}&#13;&#10;ON COLUMNS , [Dim Product].[English Product Name].ALLMEMBERS&#13;&#10;ON ROWS&#13;&#10;FROM [Adventure Works DW Cube]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="PromotionDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MyOLAP %>"
ProviderName="<%$ ConnectionStrings:MyOLAP.ProviderName %>" SelectCommand="WITH&#13;&#10;MEMBER [Measures].[ParameterCaption]&#13;&#10;AS '[Dim Promotion].[Eng
create proc dba_ProcessDeadlockGraphs
as
set nocount on;
DECLARE @deadlock XML;
DECLARE @email_message nvarchar(MAX);
select top 1
@deadlock=DeadlockGraph
from (
SELECT XEvent.query('(event/data/value/deadlock)[1]') AS DeadlockGraph
--Sync logins
USE master;
GO
IF (OBJECT_ID('dbo.dba_SyncLogins') IS NULL) EXEC('CREATE PROCEDURE dbo.dba_SyncLogins AS 0;');
GO
ALTER PROCEDURE dbo.dba_SyncLogins
@LinkedServerPrimary sysname=NULL,
@AllowDropLogins bit=0,
@PrintOnly bit=0
--Session 1(模擬開發人員的SP邏輯)
while(1=1)
begin
create table #mytest
(
c1 int
,c2 varchar(10)
,c3 varchar(max)
,c4 nvarchar(max)
)
USE Master;
GO
EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE WITH OVERRIDE
GO
EXEC sp_configure 'xp_cmdshell', 1;
GO