sql2012 ssrs_使用SSRS查看SQL Server FILESTREAM数据

sql2012 ssrs

进出口业务 (Importing and exporting)

SQL Server FILESTREAM stores objects into the file system and applications can retrieve these objects to benefit from the IO streaming capability of the Windows OS. In my earlier articles we used the SSIS package to import and export data from the a FILESTREAM table

SQL Server FILESTREAM将对象存储到文件系统中,应用程序可以检索这些对象,从而受益于Windows OS的IO流功能。 在我以前的文章中,我们使用SSIS包从FILESTREAM表中导入和导出数据

  • Import objects into SQL Server FILESTREAM table

    将对象导入SQL Server FILESTREAM表
  • Export objects to file system from SQL Server FILESTREAM table

    从SQL Server FILESTREAM表将对象导出到文件系统

显示中 (Displaying)

When we query a FILESTREAM table using t-SQL, we cannot see the objects. In the below screenshot, you can notice that it shows the metadata for that particular object. As an alternative to display the objects from the FILESTREAM tables, we can use SSRS.

使用t-SQL查询FILESTREAM表时,看不到对象。 在下面的屏幕截图中,您会注意到它显示了该特定对象的元数据。 作为显示FILESTREAM表中对象的一种替代方法,我们可以使用SSRS。

Requirements

要求

We have the below requirements for this article

我们对本文有以下要求

准备SSRS报告以显示FILESTREAM图像的步骤 (Steps to prepare the SSRS report to display FILESTREAM images)

  • Launch Visual Studio 2017 (SSDT)

    启动Visual Studio 2017(SSDT)

  • Click on ‘Create New Project.’

    点击“创建新项目”。

Select the ‘Report Server Project Wizard’ from the Business Intelligence -> Reporting Services. You can provide a relevant name for the SSRS report and select the appropriate location.

从商业智能->报表服务中选择“报表服务器项目向导”。 您可以为SSRS报告提供相关名称,然后选择适当的位置。

It creates the solution in the directory and opens the SSRS Wizard.

它在目录中创建解决方案并打开SSRS向导。

In the next page, we need to define the data source. The Data Source needs to point out to the FILESTREAM database with the required authentication method.

在下一页中,我们需要定义数据源。 数据源需要使用所需的身份验证方法指向FILESTREAM数据库。

Enter the details in the connection manager (instance name, Windows or SQL authentication) and database name.

在连接管理器中输入详细信息(实例名称,Windows或SQL身份验证)和数据库名称。

Click on the ‘Test Connection’

点击“测试连接”

We have created the data source now.

现在,我们已经创建了数据源。

In the next page, we need to specify the query for the SSRS report.

在下一页中,我们需要为SSRS报告指定查询。

Click on the ‘Query Builder’, and it opens the Query Designer. In this wizard, we can select the tables or the stored procedure. We have already had a query for this, therefore, click on the ‘Edit as Text’

单击“查询生成器”,它将打开查询设计器。 在此向导中,我们可以选择表或存储过程。 我们已经对此进行了查询,因此,单击“编辑为文本”

Enter the t-SQL to retrieve the records from the FILESTREAM table and execute it from the run icon as shown below.

输入t-SQL从FILESTREAM表中检索记录,并从运行图标执行它,如下所示。

Click on ‘OK’ to return to report wizard.

单击“确定”以返回报告向导。

Click on the ‘Next’ and select the report type as ‘Tabular’

点击“下一步”,然后将报告类型选择为“表格”

In the next page, we need to design the SSRS report table to display the required fields.

在下一页中,我们需要设计SSRS报告表以显示必填字段。

In this article, we do not want to create any group from the available columns, therefore, drag all the columns into the details page.

在本文中,我们不想从可用列中创建任何组,因此,请将所有列拖到详细信息页面中。

You can view the report summary with the data source and data set information in the next page. Earlier we have given the name to the solution; now we can assign an appropriate name for this SSRS report.

您可以在下一页中查看报告摘要以及数据源和数据集信息。 前面我们给解决方案起了名字。 现在我们可以为此SSRS报告指定一个适当的名称。

You can preview the report here, as well, however we need to do further customization so click on the ‘Finish’. Below is the layout you can see in the SSRS report.

您也可以在此处预览报告,但是我们需要进行进一步的自定义,因此请单击“完成”。 以下是您可以在SSRS报告中看到的布局。

Drag the border of the table to give it an appropriate look.

拖动表格的边框使其具有适当的外观。

Drag the ‘Image’ from the SSIS toolbox to the ‘DocumentBin’ column.

将“图像”从SSIS工具箱拖到“文档库”列。

It opens the image properties window.

它打开图像属性窗口。

Enter the following details in the image properties window.

在图像属性窗口中输入以下详细信息。

  • Name: Enter the appropriate name, I named it as ‘FILESTSREAMImages.’ 名称 :输入适当的名称,我将其命名为“ FILESTSREAMImages”。
  • Select the image source: Select the Image source as ‘Database’ from the drop-down 选择图像源:从下拉列表中选择图像源作为“数据库”
  • Use this field: We have images metadata in the FILESTREAM table in the ‘DocumentBin’ column, therefore select this field from the drop-down 使用此字段: “ DocumentBin”列的FILESTREAM表中包含图像元数据,因此从下拉列表中选择此字段
  • Use this MIME type: In this, we can select the image format. We can use various formats such as JPEG, PNG, GIF etc 使用此MIME类型:在此,我们可以选择图像格式。 我们可以使用各种格式,例如JPEG,PNG,GIF等

Click on ‘OK’, and you can see a small image icon in the ‘DocumentBin’ column.

单击“确定”,您可以在“文档框”列中看到一个小图像图标。

Click on the ‘Preview’, and you can see the images from the FILESTREAM table.

单击“预览”,您可以从FILESTREAM表中查看图像。

In this screenshot, you can notice that image size is not equal. It does not give an excellent view of the SSRS report. Therefore, click on the ‘Design’ again to do further customization.

在此屏幕截图中,您会注意到图像大小不相等。 它不能很好地反映SSRS报告。 因此,再次单击“设计”以进行进一步的自定义。

Right click on the ‘DocumentBin’ column and select image properties.

右键单击“ DocumentBin”列,然后选择图像属性。

In the image properties, go to size. In this page, you can change the display size and the padding options for the images. As you can see by default, it displays the images as ‘Fit Proportional’ which means that SSRS will resize the images inside the items while maintaining the aspect ratio. You can also set the padding option here. We will leave the padding option as default.

在图像属性中,调整尺寸。 在此页面中,您可以更改图像的显示大小和填充选项。 如您所见,默认情况下,它将图像显示为“适合比例”,这意味着SSRS将在保持宽高比的同时调整项目内部图像的大小。 您还可以在此处设置填充选项。 我们将把padding选项保留为默认值。

We want to display all the images in a fixed size, therefore, select the option ‘Fit to Size’. It will resize the images to fit inside the item width.

我们要以固定大小显示所有图像,因此,选择“适合大小”选项。 它将调整图像大小以适合项目宽度。

Note: You should not change the display option as ‘Original Size’. It will display the complete image as per the original size therefore if we have large size images, the report will not be able to show correctly with other items.

注意:请勿将显示选项更改为“原始大小”。 它将按照原始大小显示完整的图像,因此,如果我们有大尺寸的图像,则报表将无法与其他项目一起正确显示。

Click ‘OK’ and preview the report again.

点击“确定”,然后再次预览报告。

In the above screenshot, you can see that images size is equal for all. It gives a nice look to the SSRS report.

在上面的屏幕截图中,您可以看到所有图片的大小均相等。 它使SSRS报告看上去很漂亮。

Let us do further customization. Currently, the report tile is displayed in a white background. We can change it to the desired colour from the properties.

让我们做进一步的定制。 当前,报告图块以白色背景显示。 我们可以从属性中将其更改为所需的颜色。

Change the background color as per the requirement.

根据要求更改背景颜色。

Now, we will deploy the report to the SSRS. In the SSDT, right click on the solution and properties

现在,我们将报告部署到SSRS。 在SSDT中,右键单击解决方案和属性

It opens the below configuration page in which we need to provide the ReportServer URL.

它将打开下面的配置页面,我们需要在其中提供ReportServer URL。

We need to provide the Report Server URL configured in the Report Server Configuration Manager.

我们需要提供在报表服务器配置管理器中配置的报表服务器URL。

Modify the TargetServerURL in the configuration page.

在配置页面中修改TargetServerURL。

Now right click on the Solution and deploy it.

现在,右键单击解决方案并进行部署。

You can see the deploy progress in the Output window. It first builds the project and then deploys it on SSRS portal.

您可以在“输出”窗口中查看部署进度。 它首先构建项目,然后将其部署在SSRS门户上。

Now we can open the SSRS report folder in the SSRS report portal (You can check the URL from the Reporting Service Configuration Manager->Web Portal URL)

现在,我们可以在SSRS报告门户中打开SSRS报告文件夹(您可以从Reporting Service配置管理器-> Web门户URL中检查URL)

Click on the folder, and you can see SRS report inside it. Click on the SSRS report to execute it.

单击该文件夹,您可以在其中看到SRS报告。 单击SSRS报告以执行它。

You can see the SQL Server FILESTREAM images using the SSRS report.

您可以使用SSRS报告查看SQL Server FILESTREAM图像。

结论: (Conclusion:)

In this article, we explored a way to view SQL Server FILESTREAM images using SSRS. We can use a custom application to view the files such as videos, documents etc. We will continue exploring the SQL Server FILESTREAM with additional articles in this series so please stay tuned.

在本文中,我们探索了一种使用SSRS查看SQL Server FILESTREAM映像的方法。 我们可以使用自定义应用程序来查看文件,例如视频,文档等。我们将继续探索SQL Server FILESTREAM,以及本系列的其他文章,敬请关注。

目录 (Table of contents)

FILESTREAM in SQL Server
Managing data with SQL Server FILESTREAM tables
SQL Server FILESTREAM Database backup overview
Restoring a SQL Server FILESTREAM enabled database
SQL Server FILESTREAM database recovery scenarios
Working with SQL Server FILESTREAM – Adding columns and moving databases
SQL Server FILESTREAM internals overview
Importing SQL Server FILESTREAM data with SSIS packages
SQL Server FILESTREAM queries and Filegroups
Viewing SQL Server FILESTREAM data with SSRS
SQL Server FILESTREAM Database Corruption and Remediation
Export SQL Server FILESTREAM Objects with PowerShell and SSIS
SQL FILESTREAM and SQL Server Full Text search
SQL Server FILESTREAM and Replication
SQL Server FILESTREAM with Change Data Capture
Transaction log backups in a SQL FILESTREAM database
SQL FILESTREAM Compatibility with Database Snapshot, Mirroring, TDE and Log Shipping
SQL Server FILETABLE – the next generation of SQL FILESTREAM
Managing Data in SQL Server FILETABLEs
SQL Server FILETABLE Use Cases
SQL Server中的文件流
使用SQL Server FILESTREAM表管理数据
SQL Server FILESTREAM数据库备份概述
还原启用了SQL Server FILESTREAM的数据库
SQL Server FILESTREAM数据库恢复方案
使用SQL Server FILESTREAM –添加列和移动数据库
SQL Server FILESTREAM内部概述
使用SSIS包导入SQL Server FILESTREAM数据
SQL Server FILESTREAM查询和文件组
使用SSRS查看SQL Server FILESTREAM数据
SQL Server FILESTREAM数据库损坏和修复
使用PowerShell和SSIS导出SQL Server FILESTREAM对象
SQL FILESTREAM和SQL Server全文搜索
SQL Server FILESTREAM和复制
具有更改数据捕获功能SQL Server FILESTREAM
SQL FILESTREAM数据库中的事务日志备份
SQL FILESTREAM与数据库快照,镜像,TDE和日志传送的兼容性
SQL Server FILETABLE –下一代SQL FILESTREAM
在SQL Server FILETABLEs中管理数据
SQL Server FILETABLE用例

翻译自: https://www.sqlshack.com/viewing-sql-server-filestream-data-with-ssrs/

sql2012 ssrs

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值