sqlserver日期函数_SQLServerReportingService报表之命令行部署脚本介绍

时间:2018-05-17  来源:公务员类考试  阅读:

  使用 SQL Server Reporting Service 的朋友应该都会遇到与此类似的问题, 尤其是在产品中, 比如我们有若干个报表形成的一个产品, 这些报表是需要用户部署在报表服务器上的才能使用的, 我们可以只给用户 RDL 报表文件和一个文档教程, 让他们自己上传, 自己配置数据源等等, 但是这样也许令人感到这个产品太不人性化, 而 SQL Server Reporting Service 也想到了这点, 它给我们提供了一个名为 RS.exe 的小工具, 这个工具就可以帮助我们以命令行的形式做一些有关 Reporting Service 的工作, 现在先介绍一下 RS.exe 工具中的主要功能:
  首先使用-?命令获取一些帮助信息:
  D:RS>rs -?
  Microsoft (R) Reporting Services RS
  Version 10.0.1600.22 ((SQL_PreRelease).080709-1414 ) x86
  Executes script file contents against the specified Report Server.
  RS -i inputfile -s serverURL [-u username] [-p password]
    [-l timeout] [-b] [-e endpoint] [-v var=value] [-t]
  -i inputfile  Script file to execute
  -s serverURL  URL (including server and vroot) to execute
  script against.
  -u usernameUser name used to log in to the server.
  -p passwordPassword used to log in to the server.
  -e endpointWeb service endpoint to use with the script.
  Options are:
  Exec2005 - The ReportExecution2005 endpoint
  Mgmt2005 - The ReportService2005 endpoint
  -l timeout Number of seconds before the connection to the
  server times out. Default is 60 seconds and 0 is
  infinite time out.
  -b Run as a batch and rollback if commands fail
  -v var=value  Variables and values to pass to the script
  -t trace  Include trace information in error message
  
  其实看上去也不难, 其中重点介绍一个参数, 大家可以看到-i这个参数中需要传输一个脚本文件给该工具, 其实这个脚本文件也是一般的VB.NET语法写的, 在网上查了一些资料, SQL Server 安装包中没有默认包含脚本实例, 所以我们需要自己下载一下, 大家可以通过: http://www.codeplex.com/MSFTRSProdSamples 这个网站下载并安装, 其中会下载到一个安装包, 它包含了所有 SQL Server 中技术的实例, 安装完成后, 我们进入C:Program FilesMicrosoft SQL Server90SamplesReporting Services 目录, 然后找到一个名为 "Script Samples" 的目录, 这个目录中有若干个RSS为后缀的文件, 这些文件就是脚本文件里, 打开一个名为PublishSampleReports.rss看一下, 内容如下:
  ’ File: PublishSampleReports.rss
  ’
  ’ Summary: Demonstrates a script that can be used with RS.exe to
  ’ publish the sample reports that ship with Reporting Services.
  ’
  ’ This file is part of Microsoft SQL Server Code Samples.
  ’
  ’ Copyright (C) Microsoft Corporation. All rights reserved.
  ’
  ’ This source code is intended only as a supplement to Microsoft
  ’ Development Tools and/or on-line documentation. See these other
  ’ materials for detailed information regarding Microsoft code samples.
  ’
  ’ THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  ’ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  ’ IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A#p#分页标题#e#
  ’ PARTICULAR PURPOSE.
  ’
  ’ 1.0 Documentation
  ’
  ’ Read the following in order to familiarize yourself with the sample script.
  ’
  ’ 1.1 Overview
  ’
  ’ This sample script uses a script file (.rss) and the script environment to run
  ’ Web service operations on a specified report server. The script creates a folder
  ’ that you specify as a command-prompt variable using the 杤 switch, and then
  ’ publishes the sample reports that ship with Reporting Services to a report server.
  ’ Depending on the location of your sample reports, you may need to modify the
  ’ value of the filePath variable, which references the path to your sample reports.
  ’
  ’ 1.2 Script Variables
  ’
  ’ Variables that are passed on the command line with the -v switch:
  ’
  ’ (a) parentFolder - corresponds to the folder that the script creates and uses
  ’ to contain your published reports
  ’
  ’ 1.3 Sample Command Lines
  ’
  ’
  ’ 1.3.1 Use the script to publish the sample reports to an AdventureWorks Sample Reports folder.
  ’
  ’  rs -i PublishSampleReports.rss -s http://myserver/reportserver
  ’
  Dim definition As [Byte]() = Nothing
  Dim warnings As Warning() = Nothing
  Dim parentFolder As String = "AdventureWorks Sample Reports"
  Dim parentPath As String = "/" + parentFolder
  Dim filePath As String = "C:Program FilesMicrosoft SQL Server90SamplesReporting ServicesReport SamplesAdventureWorks Sample Reports"

 

 

sqlserver日期函数_SQLServerReportingService报表之命令行部署脚本介绍

http://m.kwkids.com/gongwuyuan/8408.html

推荐访问:sqlserver日期转换
相关阅读 猜你喜欢
本类排行 本类最新