由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - SSIS DYNAMIC EXCEL输出的问题
相关主题
用SSIS EXPORT 到 EXCEL 2010 有2000个COLUMN,可能吗SSIS: execute SQL task failed on Insert statements
再请教大牛一个问题SQL Server 2005 Exec( )
SSRS report failing to display dataset stringNeed help to read .xls to SQLServer2005 Through SSIS Wizard
请教:sql, 同时得出count_lastweek & count_all老印给我的一个Challenge
SQL Server - convert datetime to a string YY-MM-DD HH德州招SQL Developer
这题目啥意思啊?怎么LOAD 大量EXCEL或者CVS DATA?
请问sql server里面怎么输出变量到文本文件?Access database 求助
sybase 问题请教how to keep data integrity in excel
相关话题的讨论汇总
话题: excel话题: create话题: data话题: ssis话题: table
进入Database版参与讨论
1 (共1页)
s**********o
发帖数: 14359
1
SSIS要每天输出一个动态的EXCEL,比如REPORT20131001.XLS, REPORT20131002.XLS
等等,这个SSIS的DATA FLOW TASK居然HANDLE不了动态的EXCEL DESTINATION,
非要搞个TEMPLATE, COPY FILE,或者用CMDSHELL去创建,这也太土了,
这么一个基本的报表输出问题,都这么费劲
b******g
发帖数: 3883
2
你水平不行啊,是可以的。google create dynamic excel ssis

【在 s**********o 的大作中提到】
: SSIS要每天输出一个动态的EXCEL,比如REPORT20131001.XLS, REPORT20131002.XLS
: 等等,这个SSIS的DATA FLOW TASK居然HANDLE不了动态的EXCEL DESTINATION,
: 非要搞个TEMPLATE, COPY FILE,或者用CMDSHELL去创建,这也太土了,
: 这么一个基本的报表输出问题,都这么费劲

s**********o
发帖数: 14359
3
GOOGLE了半天都是失败的,其实很明显,没有EXCEL FILE之前
就没法MAPPING到EXCEL的TAB里去

【在 b******g 的大作中提到】
: 你水平不行啊,是可以的。google create dynamic excel ssis
b******g
发帖数: 3883
4
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/bda433a
Steps:
1. Click on package properties. Set "DelayValidation" property to True.
The package will not validate tasks, connections, until they are executed.
2. Create a package level variable "XLFileRootDir" as string and set it to
the root
directory where you want the excel file to be created.
Example: C:\Project\Data\
3. Create an Excel connection in the connection manager. Browse to the
target directory
and select the destination XL filename or type it in. It doesn't matter if
the file doesn't exist.
4. Go to the Excel connection properties and expand the expressions ellipse
(The button
with "..." on it).
Under the property drop down, select 'ExcelFilePath' and click on the
ellipse to
configure the expression:
@[User::XLFileRootDir] + (DT_WSTR, 2) DATEPART("DD", GETDATE()) + (DT_WSTR,
2) DATEPART("MM", GETDATE()) + (DT_WSTR, 4) DATEPART("YYYY", GETDATE()) +".
xls"
This should create an xl file like 01132007.xls.
5. Add a SQL task to package and double click to edit.
In the general tab, set 'ConnectionType' to 'Excel'.
For 'SQLStatement', enter the create table SQL to create destination table.
For example:
CREATE TABLE `Employee List` (
`EmployeeId` INTEGER,
`EmployeeName` NVARCHAR(20)
)
Copy the create table command. It will come in handy later.
6. Add a Data Flow task. In the data flow editor, add an OLEDB source and an
Excel destination.
Configure the source to select EmployeeId and EmployeeName from a table.
7. Connect this to Excel destination. In the destination editor, select the
Excel connection in the
manager, choose 'table or view' for data access mode and for 'name of the
Excel sheet' click on
new button and paste the create table command from Step 5.
Map the columns appropriately in the mappings tab and you are done.
s**********o
发帖数: 14359
5
问题出在最后一部的MAPPING上,根本就不能选NAME OF THE EXCEL SHEET
直接就INVALID ARGUMENT了,因为EXCEL FILE不存在,所以根本没有SHEET可选,
没有SHEET怎么MAPPING
s**********o
发帖数: 14359
6


【在 s**********o 的大作中提到】
: 问题出在最后一部的MAPPING上,根本就不能选NAME OF THE EXCEL SHEET
: 直接就INVALID ARGUMENT了,因为EXCEL FILE不存在,所以根本没有SHEET可选,
: 没有SHEET怎么MAPPING

s**********o
发帖数: 14359
7
根本就没有第七步的OPTION就ERROR掉了 click on
new button and paste the create table command from Step 5.
Map the columns appropriately in the mappings tab and you are done.
b******g
发帖数: 3883
8
我刚才做了一下是works,我是sql server 2008 bids,在"name of excel sheet" 右边
有个 new ,不知道你的为啥没有,你和oledb source 连了吗?

【在 s**********o 的大作中提到】
: 根本就没有第七步的OPTION就ERROR掉了 click on
: new button and paste the create table command from Step 5.
: Map the columns appropriately in the mappings tab and you are done.

s**********o
发帖数: 14359
9
我的EXCELFILEPATH有些问题,因为是两个USER VARIABLE链接起来的,其实是@PATH+@
FILENAME,EVALUATE的话不出值,不过CREATE TABLE就是CREATE EXCEL FILE了,
CONNECT STRING显示这个
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=;Extended Properties="EXCEL 12
.0;HDR=YES";
b******g
发帖数: 3883
10
你data source 不应该是空的,应该是
c:\temp\4102013.xlsx

【在 s**********o 的大作中提到】
: 我的EXCELFILEPATH有些问题,因为是两个USER VARIABLE链接起来的,其实是@PATH+@
: FILENAME,EVALUATE的话不出值,不过CREATE TABLE就是CREATE EXCEL FILE了,
: CONNECT STRING显示这个
: Provider=Microsoft.ACE.OLEDB.12.0;Data Source=;Extended Properties="EXCEL 12
: .0;HDR=YES";

s**********o
发帖数: 14359
11
是EXCELFILEPATH的问题,链接的USER VARIABLES不能EVALUE出值来,
改好了,不需要NEW了,我在DATA FLOW之前用了个CREATE TAB的
SQL TASK,谢谢你啊
1 (共1页)
进入Database版参与讨论
相关主题
how to keep data integrity in excelSQL Server - convert datetime to a string YY-MM-DD HH
求助:ssis输出到excel,自动在每个cell添加了single quote。如何避免这题目啥意思啊?
SSIS package import excel, 只能load 255 rows请问sql server里面怎么输出变量到文本文件?
求科普database方向sybase 问题请教
用SSIS EXPORT 到 EXCEL 2010 有2000个COLUMN,可能吗SSIS: execute SQL task failed on Insert statements
再请教大牛一个问题SQL Server 2005 Exec( )
SSRS report failing to display dataset stringNeed help to read .xls to SQLServer2005 Through SSIS Wizard
请教:sql, 同时得出count_lastweek & count_all老印给我的一个Challenge
相关话题的讨论汇总
话题: excel话题: create话题: data话题: ssis话题: table