System variables, logging and the Execute SQL Task...(zz)

原文地址http://sqljunkies.com/WebLog/knight_reign/archive/2005/02/27/8187.aspx
Here's something useful you can do with system variables and the SQL Task. Logging in SSIS is more flexible and there are more options for logging destinations and formats then with DTS. However, it may not always be as surgical as you'd like it to be, and you can only create log events that the components support.
 
  • You can use a script component or task and log custom log events “on the fly“. This has value in some cases.
  • You can create a custom task in which you can create custom log events that you may actually filter. I think there is someone writing one of these now. :)
  • You can build a pipeline to output to various formats.
  • You can use the SQL Task to log custom data using parameter mapping and variables.

I've created a very simple package run log that illustrates the last option. Granted, the package already logs a similar set information, but it's a good example because it's easy to compare the two approaches. Using the SQL Task, I have created a simple log table that logs the username, packagename, machinename, packageID and starttime for each time a package gets executed.

First, I created a table as follows.

use Playland
CREATE TABLE PackageRun (
username varchar(50),
packagename varchar(50),
machinename varchar(50),
packageID varchar(50),
starttime datetime
);

Then in the SQL Task, I have the following insert statement:
INSERT INTO PackageRun VALUES(?,?,?,?,?);
/* username    varchar(50),
packagename varchar(50),
machinename varchar(50),
packageID   varchar(50),
starttime   date */

Here's where the system variables come in handy. The Parameter Mapping tab looks like this:

I've put this SQL Task in the package at package scope to log simple information about the run of the package. Now, whenever I run the package, it enters a log into the PackageRun table as shown below.

Existing log events cover a lot of ground. The logging infrastucture generously handles the general case for logging, but it's a broad brush and doesn't always get as detailed as you'd like. There are cases where there is no way to log specific information. For example, parameters to event handlers, the LocaleID of a specific container and task execution values. This logging mechanism can be used for just about any type of custom logging you'd like at anytime during the execution of the package and is great for one off, surgical logging of custom data that the existing log infrastructure doesn't support. If you ever run into the situation where you wished something got logged, but it doesn't, this method may fill in the gaps.

Let me know if this was useful to you.

Thanks,
Universe.Earth.Software.Microsoft.SQLServer.IS.KirkHaselden

转载于:https://www.cnblogs.com/stu-acer/archive/2008/01/23/1050675.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/264650.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

mysql linux文件_MySQL在Linux系统下配置文件详解

在日常的的开发过程中接触到了SQLServer和MySQL数据库的操作性问题,可能是以前接触的都是SQL Server,才开始接触MySQL,总感觉使用MySQL没有使用SQLserver那么顺手,一些关键的系统函数,比如说开窗、行转列、列转行、自增…

logger

log4j日志配置关键字: apache log4j 1、配置根Logger:log4j.rootLogger [ level ] , appenderName, appenderName2level&#xff1a;日志的级别&#xff0c;指定这条日志信息的重要性。分为ALL < DEBUG < INFO < WARN 一般常用的为 DEBUG &#xff0c; INFO &#xf…

如何实现从wgs-84到beijing54的坐标转换

摘要&#xff1a;关于这个坐标系的转化网上有很多文章探讨了各种转换的方法。通过自己的学习&#xff0c;我自己做了一下总结&#xff0c;同时给出了其中要遇到的部分术语和数据&#xff0c;方便以后查阅使用。主要介绍的是&#xff1a;3参数&#xff08;七参数&#xff09;转换…

增删改查(curd)

curd的解释: 代表创建&#xff08;Create&#xff09;、更新&#xff08;Update&#xff09;、读取&#xff08;Retrieve&#xff09;和删除&#xff08;Delete&#xff09; 查询基本使用 查询所有列select * from 表名; 例&#xff1a; select * from classes; 查询指定列可以…

mysql group by 别名_[转]为什么group by后面不能使用别名(除MySQL)

同事工作中遇到一个问题&#xff1a;select count(billingdate),to_char(billingdate,YYYYmm) monthfrom tu_tradewhere to_char(billingdate,YYYY) 2017and reportstat 30group by month;-----执行报错&#xff0c;cant resolve month............因为Sql语句执行顺序(7) …

R内存扩展 win7内存扩展

安装包 imdiskinst 文件 램디스크 사용http://www.ltr-data.se/ http://cruciancar.blog.me/150101634586 --TEMP 변수 TEMP,TMP%USERPROFILE%\AppData\Local\Temp%USERPROFILE%\AppData\Local\Temp --Licensehttp://linsoo.co.kr/2281 --추가imdisk.exe -a -t vm -m r: -s 102…

POJ 1150 The Last Non-zero Digit 数论+容斥

POJ 1150 The Last Non-zero Digit 数论容斥 题目地址: POJ 1150 题意&#xff1a; 求排列P(n, m)后面第一个非0的数。 分析&#xff1a; 为了熟悉题目中的理论。我先做了俩0基础的题目&#xff1a; POJ 1401。题解见&#xff1a;POJ 1401 && ZOJ 2202 Factorial 阶乘…

redis mysql原理_MYSQL MONGODB REDIS 同步原理以及高可用性对比

MySQL1、异步复制&#xff1a;2、半同步复制&#xff1a;同步出现超时后会自动变回异步复制&#xff1b;MongoDBMongoDB的副本集是一组mongod进程的集合&#xff0c;提供冗余和高可用性。最小的的副本集包含(1个primary、1个secondary和1个arbiter)&#xff0c;大多数的部署包含…

使用JSON JavaScriptSerializer 进行序列化或反序列化时出错。字符串的长度超过了为 maxJsonLength属性...

<system.web.extensions><scripting><webServices><jsonSerialization maxJsonLength"1024000" /></webServices></scripting> </system.web.extensions> 使用 JSON JavaScriptSerializer 进行序列化或反序列化时出错。字…

XML数据岛(XML Data Island)(只适用于ie)

< DOCTYPE html PUBLIC -WCDTD XHTML StrictEN httpwwwworgTRxhtmlDTDxhtml-strictdtd> 在Microsoft Internet Explorer 5.0及以后的版本里里&#xff0c;你可以利用XML元素来创建数据岛&#xff0c;数据岛就是被HTML页面引用或包含的XML数据&#xff0c;XML数据可以包含…

并不对劲的bzoj3994:loj2185:p3327[SDOI2015]约数个数和

题目大意 设d(x)为x的约数个数&#xff0c;\(t\)组询问&#xff0c;给定\(n,m\)(\(t,m,n\leq5*10^4\))&#xff0c;求$ \sum^n_{i1}\sum^m_{j1}d(i*j)$ 题解 假设\(n\leq m\) 设\(ip_1^{a_1}*p_2^{a_2}*...*p_k^{a_k},jp_1^{b_1}*p_2^{b_2}*...*p_k^{b_k}\) 对于\(i*j\)的某个约…

mysql redo原子写_InnoDB如何保证redolog的完整性?

redo log里记录的只是对数据库页面的更改&#xff0c;它记录着类似『更改页面x 的指定偏移量的数据为k』这样的信息&#xff0c;是完全二进制的log(数据库原理概念上的&#xff0c;不是指MySQL binlog&#xff0c;MySQL binlog不是二进制log)&#xff1b;在redo log里并没有存储…

ArcGIS 9.2 Server Pack 5 蓄势待发

ArcGIS 9.2补丁真是不少&#xff0c;快把开发人员给淹没了&#xff0c;之前版本的ArcGIS从来没有发布过sp4&#xff0c;现在已经通知马上要发布sp5&#xff0c;修正了大量desktop、engine、server上的bug&#xff0c;估计这应该是9.2最后一组补丁了&#xff0c;记得上次Jack来北…

jenkins maven没有使用全局设置文件地址_Jenkins手把手图文教程「基于Jenkins 2.164.1」...

一、下载前往https://jenkins.io/download/ &#xff0c;按需下载。如用于生产&#xff0c;建议下载Long-term Support (LTS) 版本&#xff0c;这样能够获得相对长期的维护&#xff1b;如想体验最新的功能&#xff0c;可尝试 Weekly 版本。可以直接下载特定系统专属的版本&…

游戏数值策划-经验值计算公式设计(自百度文库)

较复杂的概念源自于设计师对游戏整体的把握&#xff0c;例如我们在设计游戏中主角的成长经验值时&#xff0c;并不能随意给出个公式就了事&#xff0c;那是毫不负责任的。 经验计算的基础模型 我们通常说的成长所需经验公式大多是&#xff1a; 每级升级所需经验Lv^3*修正值修正…

[原创]flex 3 + .net开发flash Remoting一 --- 开发环境

flex 3 .net开发flash Remoting一 --- 开发环境 本篇文章将介绍flash Remoting 开发的必备的运行环境和相关配置过程&#xff1a;一。开发必备环境。 1. flex 3&#xff0c;请从Adobe官方网站下载或其它地方找D版(目前为止D版还没有出)。 2. Visual Studio 2005&#…

【转】winform回车变为tab

源地址&#xff1a;http://www.cnblogs.com/wohexiaocai/p/4302200.html转载于:https://www.cnblogs.com/haizine/p/10484454.html

接视频Java 数据库

http://pan.baidu.com/s/1mg1EYAO windows各种版本map.centerAndZoom(point,15);这句话可以指向地图的不同位置百度云http://developer.baidu.com/map/jsdemo.htm#i1_1?qq-pf-topcqq.c2c1 百度云粉丝 http://yun.baidu.com/share/home?uk1814500964&viewshare#categor…

Lachesis Shield 设计上的抉择

最近有很多朋友和同学跟我谈起 Lachesis Shield 设计上的一些问题。我想我需要总结一下我的设计策略&#xff0c;虽然这是个看起来简单得不能再简单的工具。我面临的选择&#xff1a;1 界面位置显然&#xff0c;有很多位置可以摆放这么个不起眼的东西&#xff0c;比如说&#x…

mysql表恢复报错binlog_mysqlbinlog 恢复报错ERROR at line 24826643: Unknown command '\'汗血宝马...

有两个binlog日志文件mysql-bin.000001,mysql-bin.000002&#xff0c;大小都是1G左右。现在要在另外一个库上做完全恢复。想到通常的恢复方法&#xff1a;mysqlbinlog /usr/local/var/mysql1/mysql-bin.000001 | mysql -uroot -S /usr/local/var/mysql2/mysql2.sockmysqlbinlog…