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
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 |
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
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)); |
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
//簡訊王發送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"; |
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
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)) |
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
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, |
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
<form id="form1" runat="server"> | |
<div> | |
<asp:SqlDataSource ID="ProductsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MyOLAP %>" | |
ProviderName="<%$ ConnectionStrings:MyOLAP.ProviderName %>" SelectCommand="WITH MEMBER [Measures].[ParameterCaption] AS '[Dim Product].[English Product Name].CURRENTMEMBER.MEMBER_CAPTION' MEMBER [Measures].[ParameterValue] AS '[Dim Product].[English Product Name].CURRENTMEMBER.UNIQUENAME' SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue]} ON COLUMNS , [Dim Product].[English Product Name].ALLMEMBERS ON ROWS FROM [Adventure Works DW Cube]"> | |
</asp:SqlDataSource> | |
<asp:SqlDataSource ID="PromotionDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MyOLAP %>" | |
ProviderName="<%$ ConnectionStrings:MyOLAP.ProviderName %>" SelectCommand="WITH MEMBER [Measures].[ParameterCaption] AS '[Dim Promotion].[Eng |
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 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 |
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
--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 |
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
--Session 1(模擬開發人員的SP邏輯) | |
while(1=1) | |
begin | |
create table #mytest | |
( | |
c1 int | |
,c2 varchar(10) | |
,c3 varchar(max) | |
,c4 nvarchar(max) | |
) |
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 Master; | |
GO | |
EXEC sp_configure 'show advanced options', 1; | |
GO | |
RECONFIGURE WITH OVERRIDE | |
GO | |
EXEC sp_configure 'xp_cmdshell', 1; | |
GO |
NewerOlder