Chinese version: http://www.cnblogs.com/WilsonWu/archive/2009/02/19/1394198.html

Some times when we use the SQL Server Reporting Service will get the same problem, if we have a product constituted by some reports, and there is a new release will be published, we want to get a better way instead of give are RDL files to users directly. actually, SQL Server Reporting already has a tool named RS.exe to help us do some works such as deployment by command line. and today I will introduce main functions in this RS.exe tool:

At first, we use –? to get help information like below:

SQL Server Reporting Service - Deployment by command lineD:\RS>rs -? 
SQL Server Reporting Service - Deployment by command lineMicrosoft 
(R) Reporting Services RS 
SQL Server Reporting Service - Deployment by command lineVersion 
10.0.1600.22 ((SQL_PreRelease).080709-1414 ) x86 
SQL Server Reporting Service - Deployment by command lineExecutes script file contents against the specified Report Server
. 
SQL Server Reporting Service - Deployment by command lineRS -i inputfile -s serverURL [-u username] [-p password] 
SQL Server Reporting Service - Deployment by command line   [-l timeout] [-b] [-e endpoint] [-v var
=value] [-t] 
SQL Server Reporting Service - Deployment by command line
SQL Server Reporting Service - Deployment by command line        -i  inputfile   Script file to execute 
SQL Server Reporting Service - Deployment by command line        -s  serverURL   URL 
(including server and vroot) to execute 
SQL Server Reporting Service - Deployment by command line                        script against
. 
SQL Server Reporting Service - Deployment by command line        -u  username    User name used to log in to the server
. 
SQL Server Reporting Service - Deployment by command line        -p  password    Password used to log in to the server
. 
SQL Server Reporting Service - Deployment by command line        -e  endpoint    Web service endpoint to 
use with the script. 
SQL Server Reporting Service - Deployment by command line                        Options are: 
SQL Server Reporting Service - Deployment by command line                        Exec2005 - The ReportExecution2005 endpoint 
SQL Server Reporting Service - Deployment by command line                        Mgmt2005 - The ReportService2005 endpoint 
SQL Server Reporting Service - Deployment by command line        -l  timeout     Number of seconds before the connection to the 
SQL Server Reporting Service - Deployment by command line                        server times out
. Default is 60 seconds and 0 is 
SQL Server Reporting Service - Deployment by command line                        infinite 
time out. 
SQL Server Reporting Service - Deployment by command line        -b              
Run as a batch and rollback if commands fail 
SQL Server Reporting Service - Deployment by command line        -v  var
=value   Variables and values to pass to the script 
SQL Server Reporting Service - Deployment by command line        -t  
trace       Include trace information in error message

 

In fact, that is not hard to understand, only the “-i” parameter maybe has some questions, all right, the “-i” parameter need a script that can run some code to do our work, the script can be wrote by VS.NET, and I have got some information for the script here. at first you must go to the http://www.codeplex.com/MSFTRSProdSamples site to get a sample package, and this have not include into SQL Server install package. after install it go to your SQL Server location like C:\Program Files\Microsoft SQL Server\90\Samples\Reporting Services, you can see a folder named “Script Samples”, then open it and find the “PublishSampleReports.rss” file like below:

 

SQL Server Reporting Service - Deployment by command line'============================================================================= 
SQL Server Reporting Service - Deployment by command line'
  File:      PublishSampleReports.rss 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
  Summary:  Demonstrates a script that can be used with RS.exe to 
SQL Server Reporting Service - Deployment by command line'
         publish the sample reports that ship with Reporting Services. 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
--------------------------------------------------------------------- 
SQL Server Reporting Service - Deployment by command line'
 This file is part of Microsoft SQL Server Code Samples. 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
  Copyright (C) Microsoft Corporation.  All rights reserved. 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
 This source code is intended only as a supplement to Microsoft 
SQL Server Reporting Service - Deployment by command line'
 Development Tools and/or on-line documentation.  See these other 
SQL Server Reporting Service - Deployment by command line'
 materials for detailed information regarding Microsoft code samples. 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
 THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 
SQL Server Reporting Service - Deployment by command line'
 KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 
SQL Server Reporting Service - Deployment by command line'
 IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 
SQL Server Reporting Service - Deployment by command line'
 PARTICULAR PURPOSE. 
SQL Server Reporting Service - Deployment by command line'
============================================================================= 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
 1.0 Documentation 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
 Read the following in order to familiarize yourself with the sample script. 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
 1.1 Overview 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
 This sample script uses a script file (.rss) and the script environment to run 
SQL Server Reporting Service - Deployment by command line'
 Web service operations on a specified report server. The script creates a folder 
SQL Server Reporting Service - Deployment by command line'
 that you specify as a command-prompt variable using the 杤 switch, and then 
SQL Server Reporting Service - Deployment by command line'
 publishes the sample reports that ship with Reporting Services to a report server. 
SQL Server Reporting Service - Deployment by command line'
 Depending on the location of your sample reports, you may need to modify the 
SQL Server Reporting Service - Deployment by command line'
 value of the filePath variable, which references the path to your sample reports. 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
 1.2 Script Variables 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
 Variables that are passed on the command line with the -v switch: 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
 (a) parentFolder - corresponds to the folder that the script creates and uses 
SQL Server Reporting Service - Deployment by command line'
     to contain your published reports 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
 1.3 Sample Command Lines 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
 1.3.1 Use the script to publish the sample reports to an AdventureWorks Sample Reports folder. 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line'
       rs -i PublishSampleReports.rss -s http://myserver/reportserver 
SQL Server Reporting Service - Deployment by command line'
 
SQL Server Reporting Service - Deployment by command line

SQL Server Reporting Service - Deployment by command line
Dim definition As [Byte]() = Nothing 
SQL Server Reporting Service - Deployment by command line
Dim warnings As Warning() = Nothing 
SQL Server Reporting Service - Deployment by command line
Dim parentFolder As String = "AdventureWorks Sample Reports" 
SQL Server Reporting Service - Deployment by command line
Dim parentPath As String = "/" + parentFolder 
SQL Server Reporting Service - Deployment by command line
Dim filePath As String = "C:\Program Files\Microsoft SQL Server\90\Samples\Reporting Services\Report Samples\AdventureWorks Sample Reports\" 
SQL Server Reporting Service - Deployment by command line
 

 

Except some RS server code, we can get all clear method for Upload report or configuration Data Sources, then you can use them into your own script.

For example:

SQL Server Reporting Service - Deployment by command lineRS -"PublishReports.rss" -"http://[ReportServer]/ReportServer/"

Use above command you can deploy your reports easily.

In next post I will share some best practice to use RS.exe deploy TFS reports.

Thanks!

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-13
  • 2021-07-10
  • 2022-12-23
  • 2021-11-15
  • 2022-12-23
猜你喜欢
  • 2021-04-29
  • 2021-09-07
  • 2022-01-09
  • 2021-11-28
  • 2022-01-09
  • 2022-03-03
相关资源
相似解决方案