sql创建表主键gui

介绍 ( Introduction )

Oft times we are forced into situations where we clearly need to think outside of the box. A case at hand arose early in 2014 where one of our client’s required a “quick and dirty” front end to modify data within a table that reflected the outstanding balances (of their clients) and the attempts that they had made to recover these funds. Master Data Services seemed to be the way to go!

通常,我们常常被迫陷入明显需要跳出框框思考的情况。 2014年初发生了一起案件,其中一位客户要求“快速而肮脏的”前端修改表中的数据,以反映(客户的)未偿还余额以及他们为追回这些资金所做的尝试。 主数据服务似乎是必经之路!

Unorthodox Yes!! Abnormal No!!

非正统的!! 不正常!

In our get together today, we shall construct a similar application utilizing Master Data Services. Further I have aimed our conversation at a general level to give you all a flavour for what the product can actually do and how it can help you in your day to day business activities.

在今天的聚会中,我们将利用Master Data Services构建一个类似的应用程序。 此外,我将我们的对话的重点放在了一般性的层次上,以使您了解该产品的实际功能以及它如何在您的日常业务活动中为您提供帮助。

This said, I would ask for your feedback after having read this article, as to whether or not you would like to learn more on this topic!!

就是说,在您阅读本文之后,我想请您提供反馈,以了解您是否想了解更多有关此主题的信息!

Finally, in the interest of simplicity and time, I have taken the liberty of pre-loading Master Data Services with Product Data from Contoso and with this we shall create a working application from scratch.

最后,出于简便和时间的考虑,我自由地预装了Contoso的产品数据和主数据服务,并以此为基础创建了一个有效的应用程序。

Let’s get started!

让我们开始吧!

入门 ( Getting started )

As a starting point, I am going to assume that your SQL Server instance has access to Master Data Services. If not, the installation of the product is fairly simple and instructions are readily available on line. As always, should you have any issues, please do contact me.

首先,我将假定您SQL Server实例有权访问主数据服务。 如果不是这样,则该产品的安装非常简单,并且可以随时在线获得说明。 与往常一样,如果您有任何问题,请与我联系。

The Master Data Services client is web based. We enter the client URL and the SQL Server Master Data Services frontend is brought into view (see above).

主数据服务客户端是基于Web的。 我们输入客户端URL,然后SQL Server主数据服务前端就会显示出来(请参见上文)。

We note that there are six distinct tabs or activities. In todays “get together” as I want you to get the million meter view of the product, we shall primarily utilize the “Explorer” (see above). Note also, that the model that we shall be utilizing is the “Amsterdam01” model (which is the model that I used for my Master Data Services presentation at the PASS Amsterdam Rally, a few years back).

我们注意到有六个不同的选项卡或活动。 在今天的“聚在一起”中,正如我希望您获得的产品的百万米视图一样,我们将主要使用“ Explorer”(请参见上文)。 还要注意,我们将使用的模型是“ Amsterdam01”模型(这是几年前我在PASS阿姆斯特丹拉力赛上主数据服务演示中使用的模型)。

Clicking on the explorer tab, we find ourselves at the “Entities” tab (see above). For our purposes an entity is the same as a “table”. Our main entity / table is “Product”. Products have one or more attributes such as Color, Gender, Neck Style, Fabric, Size and Type amongst many others. This is the ‘lay of the land’ (see below).

单击资源管理器选项卡,我们将在“实体”选项卡中找到自己(请参见上文)。 就我们的目的而言,实体与“表”相同。 我们的主要实体/表格是“产品”。 产品具有一个或多个属性,例如颜色,性别,颈部样式,织物,尺寸和类型等。 这是“土地的土地”(见下文)。

Opening the Color entity (see above) we find the following “Pick List”.

打开颜色实体(见上文),我们找到以下“选择列表”。

The astute reader will note that there are two “fields” to the entity (Name and Code). These are system defined fields and are an integral part of Master Data Services. Looking at the members of the entity we note a plethora of colors (see above).

精明的读者会注意到,实体有两个“字段”(名称和代码)。 这些是系统定义的字段,是主数据服务的组成部分。 在查看实体的成员时,我们注意到过多的颜色(请参见上文)。

We note the dialogue box to the right of the screen. This is the “Details” box. Note that the color “Red” is shown for both the “Name” and “Code” fields (see above).

我们注意到屏幕右边的对话框。 这是“详细信息”框。 请注意,“名称”和“代码”字段均显示为“红色”(请参见上文)。

The IMPORTANT point is yet to come. We can manually enter another color should we wish, to meet changing business rules!!

重要的一点尚未到来。 我们可以根据需要手动输入其他颜色,以满足不断变化的业务规则!

By clicking on “Add Member” (see above) our “Detail” box is refreshed and two text boxes are displayed for us to enter a new color (see above and to the right).

通过单击“添加成员”(请参见上文),我们的“详细信息”框将刷新,并显示两个文本框供我们输入新颜色(请参见上方和右侧)。

We enter “Pers” for the “Name” and for the “Code” of our “New Color”. Pers is the Dutch word for Purple. Whilst I have a purple, Pers will help me identify entries from our Dutch office. I click OK to accept the color addition.

我们为“新颜色”的“名称”和“代码”输入“ Pers”。 Pers是荷兰语中的Purple。 虽然我的衣服是紫色的,但Pers会帮助我从荷兰办事处识别条目。 我单击确定以接受颜色添加。

In the screen shot above, we note that our new color “Pers” has been added to the list of Colors that objects may be.

在上面的屏幕截图中,我们注意到我们的新颜色“ Pers”已添加到对象可能的颜色列表中。

As with the “Color” entity, we can add members to the “Fabric” entity. Deleting or modifying entries requires some care as “orphaned products” are not permitted. This is common sense.

与“颜色”实体一样,我们可以将成员添加到“结构”实体。 删除或修改条目需要一定注意,因为不允许使用“孤立产品”。 这是常识。

产品实体 ( The Product Entity )

Opening the “Product” entity, we note that each member within the entity has a “Code” and a “Name” (see above). Note also that “Product” has been linked to the attribute “Pick lists” (Color, Fabric, Type etc.). Let us quickly look at how the attribute pick lists have been linked to the “Product” entity.

在打开“产品”实体时,我们注意到该实体中的每个成员都有一个“代码”和一个“名称”(请参见上文)。 还要注意,“产品”已链接到属性“选择列表”(颜色,织物,类型等)。 让我们快速查看属性选择列表如何链接到“产品”实体。

In order to see this we return to our main client screen by clicking on the SQL Server logo located at the top left portion of the client (see above). We click the “System Administration” tab (see above).

为了看到这一点,我们通过单击位于客户端左上方SQL Server徽标返回到主客户端屏幕(请参见上文)。 我们单击“系统管理”选项卡(见上文)。

The “System Administration” main screen is brought into view. We click the “Manage” tab and select “Entities” (see below).

进入“系统管理”主屏幕。 我们单击“管理”选项卡,然后选择“实体”(见下文)。

Our “Manage Entity” dialogue box opens.

我们的“管理实体”对话框打开。

As we may see above, all of our entities are present. We are interested in having a peak at our main entity “Product”.

正如我们上面看到的,我们所有实体都在场。 我们有兴趣在我们的主要实体“产品”上达到顶峰。

We click upon “Product” and select the pencil (see below).

我们点击“产品”并选择铅笔(见下文)。

The “Product” entity dialogue box is opened and we shall have a quick look at the “Color” attribute.

“产品”实体对话框打开,我们将快速浏览“颜色”属性。

We highlight the “Color” entity (see above) and click the pencil.

我们突出显示“颜色”实体(见上文),然后单击铅笔。

The attribute dialogue box opens. The reader will note that the source of the attribute data is “Domain based” (see above) which means that Color attribute (within the “Product” entity) is joined to another entity (our Color entity) by the “Code”. In data structure terms. The “Product” entity color code is the “key” and the corresponding color code within the “Color” entity is the “foreign key”. Any other “Product” related data that is NOT related to a satellite data entity would be classified a “Free form” entry. As a closing thought, the astute reader will realize that the “Domain based” entities must exist prior to being able to link them to the “Product” entity.

属性对话框打开。 读者会注意到,属性数据的来源是“基于域”的(参见上文),这意味着Color属性(在“ Product”实体内)通过“ Code”与另一个实体(我们的Color实体)相连。 在数据结构方面。 “产品”实体颜色代码是“键”,“颜色”实体内的相应颜色代码是“外键”。 与卫星数据实体无关的任何其他与“产品”相关的数据都将被分类为“自由格式”条目。 作为总结,精明的读者将意识到“基于域”的实体必须存在,然后才能将它们链接到“产品”实体。

Now that we understand how our “Satellite” entities are linked to the “Mommy” (Product), we are ready to leave the guts of the “Product” entity. We click the “diskette” with the red “x” located at the top left portion of the screen shot above to “exit without saving”(see above).

现在,我们了解了“卫星”实体与“妈妈”(产品)的联系方式,我们已经准备好离开“产品”实体的胆量了。 我们单击上方屏幕快照左上方带有红色“ x”的“软盘”,以“不保存即退出”(请参见上文)。

We click the SQL Server logo to go “Home”

我们单击SQL Server徽标进入“主页”

探索产品实体 ( Exploring the Product entity )

Once again we go into “Explorer” but this time we really want to have look at our main entity “Product” (see below).

我们再次进入“资源管理器”,但是这次我们真的很想看看我们的主要实体“产品”(见下文)。

Once again we shall “Add” a new member HOWEVER this time it will be to the “Product” entity.

再次,我们将“添加”新成员,但是这次将其添加到“产品”实体。

We click the “Add member” button (see the screen shot above).

我们单击“添加成员”按钮(请参见上面的屏幕截图)。

A “New Member” dialogue screen is shown in the right portion of the screen dump shown above.

上方显示的屏幕转储的右侧显示了“新成员”对话框。

We are going to enter a “SQL Shack Coat” as the “Name” and ‘999999’ as the code. Under normal circumstances, entities are set up to utilize an “identity” for the code. This avoids having to track the “last number used”. We also set the “Color” to “Pers” (as seen above).

我们将输入“ SQL Shack Coat”作为“名称”,并输入“ 999999”作为代码。 通常情况下,实体被设置为使用“身份”作为代码。 这避免了必须跟踪“最后使用的号码”。 我们还将“颜色”设置为“ Pers”(如上所示)。

I have taken the liberty of completing the new product member utilizing the remaining “Pick” list. We also note that “Design” field is a free form field which I have also completed. We click OK to complete the data entry.

我拥有利用剩余的“选择”列表来完成新产品成员的自由。 我们还注意到,“设计”字段是我也已填写的自由格式字段。 单击确定以完成数据输入。

Back at our main “Product” entity screen, we see that our new record have been added. Wait a minute, we may have created a bad data entry. SQL Shack Coats come solely in “Purple”. We must fix this record!

回到我们的“产品”实体主屏幕,我们看到已经添加了新记录。 请稍等,我们可能创建了错误的数据条目。 SQL Shack外套仅以“紫色”形式出现。 我们必须解决这个记录!

修改现有成员 ( Modifying an existing member )

Clicking upon our “SQL Shack Coat” product, we note that the attribute values are visible on the right hand side.

单击我们的“ SQL Shack Coat”产品,我们注意到属性值在右侧可见。

We change the “Color” from “Pers” to “Purple” and click “OK”.

我们将“颜色”从“ Pers”更改为“ Purple”,然后单击“ OK”。

We now see that our member has been successfully altered.

现在,我们看到我们的成员已成功更改。

As a quick recap, thus far we have been introduced to Master Data Services at the fifty million meter high level. We have discussed the concept of a “Main” entity (in our case “Product”) and the usage of satellite “pick list” entities (Color etc.). Entering the actual colors into the “Color” entity (as it is a foreign entity), we entered the actual color “Codes” and “Names” as free form text. Once the satellite entities have been created we may create the “Product” entity and utilize the values within the satellite entities as attribute values for our “Product” members. We also remember that the color choices for the color attribute of the “Product” entity come from the “Color” pick list entity. Finally “Product” related modifications may be effected to keep our data fresh and up to date.

简要回顾一下,到目前为止,我们已经被介绍到五千万米高的主数据服务。 我们已经讨论了“主要”实体(在我们的示例中为“产品”)的概念以及卫星“选择列表”实体(颜色等)的用法。 在“颜色”实体(因为它是外国实体)中输入实际颜色,我们将实际颜色“代码”和“名称”输入为自由格式文本。 一旦创建了卫星实体,我们就可以创建“产品”实体,并利用卫星实体中的值作为“产品”成员的属性值。 我们还记得“产品”实体的颜色属性的颜色选择来自“颜色”选择列表实体。 最后,“产品”相关的修改可能会生效,以使我们的数据保持最新和最新。

所有这些数据都存储在哪里? ( Where is the all of this data stored? )

One of the hardest concepts for folks to understand when it comes to utilizing Master Data Services is that the data that we have just been looking at is an integral part of the MDS database and not in your “run of the mill “database. Further, the structure of the entity itself is not at all conducive to creating queries for reporting purposes. Within Master Data Services, data extraction is achieved rather via “views”. This said, we must create a view to view the data from Management Studio.

在使用主数据服务时,人们最难理解的概念之一是,我们一直在查看的数据是MDS数据库不可或缺的一部分,而不是您的“工厂运行”数据库中的一部分。 此外,实体本身的结构完全不利于创建用于报告目的的查询。 在主数据服务中,数据提取是通过“视图”实现的。 也就是说,我们必须创建一个视图以查看来自Management Studio的数据。

一个主要的主数据服务GOTCHA !!! 创建一个“当前”标志 ( A major Master Data Services GOTCHA!!! Creating a “Current” flag )

Master Data Services has a really kludgy feature in that data changes occur in ‘layers’. Thus when data is inserted into the initial version of our project, this data becomes the baseline data for reporting. Changes to the data are “piled upon” the initial version. Often when changes to the data occur, we wish to view these changes with our reporting tools. What is rendered within the report is the committed versions of the data instead. Committing the data is not an ongoing event and is normally done once in every twenty four hours or so. In most cases decision maker wish to see the most up to date data when it comes to the Master Data Services report. What is required is that we set up a “Current” flag.

主数据服务具有真正的糊涂功能,因为数据更改发生在“层”中。 因此,当将数据插入到我们项目的初始版本中时,该数据将成为报告的基准数据。 数据更改将“堆积”在初始版本上。 通常,当数据发生更改时,我们希望使用报告工具查看这些更改。 什么是报告中呈现的是不是 数据的提交版本 。 提交数据不是持续的事件,通常每二十四小时左右执行一次。 在大多数情况下,决策者希望查看有关主数据服务报告的最新数据。 所需要的是我们设置一个“当前”标志。

To set the “Current Flag” we select “Version Management” from the main Master Data Services screen (see below).

要设置“当前标志”,我们从主数据服务主屏幕中选择“版本管理”(见下文)。

The “Version Management” screen opens.

“版本管理”屏幕打开。

From the “Manage” ribbon we select “Flags” (see above).

从“管理”功能区中,选择“标志”(请参见上文)。

The “Manage Version Flags” dialog box opens (see above). We click the “Add” tab (see above and to the left).

“管理版本标志”对话框打开(请参见上文)。 我们单击“添加”选项卡(请参见上方和左侧)。

I have taken the liberty of setting up the flag for us. Note that we utilize the reserved word “Current”. Further, I have added a description and set the “Committed Versions Only” to false.

我已经为我们设置旗帜了。 请注意,我们使用保留字“ Current”。 此外,我添加了描述,并将“仅Committed Versions”设置为false

We save our flag by clicking on the “Save diskette”.

我们通过单击“保存磁盘”来保存我们的标志。

We find ourselves back on the “Manage Versions” screen. The most important GOTCHA to avoid is to remember to populate the “Flag” dialog box (see above). To do so, we double click on the “Flag” cell and our “Current” flag that we just created should appear as a part of a “pick list”. We choose this value (see above).

我们回到“管理版本”屏幕。 要避免的最重要的GOTCHA是记住记住填充“标志”对话框(请参见上文)。 为此,我们双击“ Flag”单元格,我们刚刚创建的“ Current”标志应出现在“ pick list”中。 我们选择此值(请参见上文)。

同时,回到牧场! ( Meanwhile, back at the ranch! )

With the “Current” flag in place, we are now ready to create our first “View” (discussed above) which will enable us to report upon the data within our SQLShack Enterprises store.

有了“当前”标记后,我们现在就可以创建我们的第一个“视图”(如上所述),这将使我们能够报告SQLShack Enterprises存储中的数据。

We now click upon the “Integration Management” tab (see above).

现在,我们单击“集成管理”选项卡(请参见上文)。

The “Integration Management” dialog box opens. We select “Create Views” (see above).

将打开“集成管理”对话框。 我们选择“创建视图”(见上文)。

The reader will note that all the entities that we have created are present on the screen (see above). We click the “ProductEntityLeafAttribute” row (see above).

读者会注意到,我们创建的所有实体都显示在屏幕上(请参见上文)。 我们点击“ ProductEntityLeafAttribute”行(见上文)。

We click the + icon to open the “Create Subscription View” dialog box.

我们点击+ 图标打开“创建订阅视图”对话框。

Once again, I have taken the liberty of setting up the view for the reader. We give the view the name “SQLShack_Products” and set the Model to “Amsterdam01’. At the bottom of the screen dump above, the reader will note that we have selected our “Current” flag from the “Version flag pick list”. This is the flag that we created above.

我再次自由地为读者设置视图。 我们给视图命名为“ SQLShack_Products”,并将模型设置为“ Amsterdam01”。 在上方屏幕转储的底部,读者会注意到我们已经从“版本标志选择列表”中选择了“当前”标志。 这是我们在上面创建的标志。

We set our “Entity” to product (once again from a “pick list”) and set the “Format” to”Leaf Members” as we want to see all the products. The option is not really relevant to our current discussion as it is more relevant to a structure where a hierarchy exists. We shall be discussing hierarchies in a future get together.

我们希望将“实体”设置为产品(再次从“选择列表”中选择一次),然后将“格式”设置为“叶成员”,以便查看所有产品。 该选项与我们当前的讨论无关,因为它与存在层次结构的结构更相关。 将来我们将讨论层次结构。

We click the save diskette (see above) to save our view.

我们单击保存软盘(参见上文)以保存我们的视图。

We find ourselves back at the “Subscription Views” screen. Let us now execute a quick query to see just what data presently exists within Master Data Services.

我们回到“订阅视图”屏幕。 现在让我们执行一个快速查询,以查看主数据服务中当前存在哪些数据。

SQL Server管理Studio ( SQL Server Management Studio )

Opening SQL Server Management Studio, we look for the Master Data Services database (MDS).

打开SQL Server Management Studio,我们查找主数据服务数据库(MDS)。

Under “Views”, we find our “SQLShack_Product” view that we just created. Selecting the first 1000 rows, we find the “SQL Shack coats” that we just added to the “Product” entity (see above). The astute reader will note that there are also numerous system defined fields within the entity. We shall be utilizing this view to pull data from Master Data Services when we create a pilot report, which we shall construct in the next section.

在“视图”下,我们可以找到刚刚创建的“ SQLShack_Product”视图。 选择前1000行,我们找到刚刚添加到“产品”实体中的“ SQL Shack外套”(请参见上文)。 精明的读者会注意到,实体中还有许多系统定义的字段。 在创建试验报告时,我们将利用该视图从主数据服务中提取数据,我们将在下一部分中进行构建。

从主数据服务创建我们的第一份报告 ( Creating our first report from Master Data Services )

Opening SQL Server Data Tools, we begin by creating a new Reporting Services project entitled “Reporting from Master Data Services”.

打开SQL Server数据工具,我们首先创建一个名为“来自主数据服务的报告”的新Reporting Services项目。

Should you be new to the world of creating a Reporting Services project and should you wish to learn more about how to work with Reporting Services, do have a look my SQL Shack article entitled “Now you see it, Now you don’t)

如果您不熟悉创建Reporting Services项目的领域,并且希望了解有关如何使用Reporting Services的更多信息,请查看我SQL Shack文章,标题为“现在,您现在看到了,现在您不知道了”

/now-see-now-dont/

/ now-see-now-dont /

Right clicking on the “Reports” folder, we click “Add” and then “New Item”.

右键单击“ Reports”文件夹,我们单击“ Add”,然后单击“ New Item”。

We add a “Report” and give our report a name “MasterDataServicesReport”. We then click “Add”.

我们添加一个“报告”,并给我们的报告命名为“ MasterDataServicesReport”。 然后,我们单击“添加”。

We are returned to our drawing surface.

我们返回到绘图表面。

Our first task is to create a new “Shared Data Source”. As we have discussed in many past articles, a “Data Source” may be likened to a water hose connecting the house water tap (the database) to the pot plants 20m from the house (the datasets behind our charts/matrices etc.).

我们的首要任务是创建一个新的“共享数据源”。 正如我们在过去的许多文章中所讨论的那样,“数据源”可以比喻为将房屋水龙头(数据库)连接到距离房屋20m的盆栽植物(我们的图表/矩阵等的数据集)之后的水管。

We right click upon the “Shared Data Source” folder. We select “Add New Data Source” (see above and to the right).

我们右键单击“共享数据源”文件夹。 我们选择“添加新数据源”(请参见上方和右侧)。

The “Shared Data Source Properties” dialogue box is brought up. We click “Edit” (see above and to the right). The “Connections Properties” dialog box is brought up (see above). We set the server name and select the MDS database for the “Select or enter a database name” option (see above).

出现“共享数据源属性”对话框。 我们单击“编辑”(请参见上方和右侧)。 出现“连接属性”对话框(请参见上文)。 我们设置服务器名称,并为“选择或输入数据库名称”选项选择MDS数据库(请参见上文)。

We test the connection (see above). We click OK, OK, and OK to return to our work surface.

我们测试连接(请参见上文)。 我们单击“确定”,“确定”和“确定”以返回到工作界面。

We note that the new shared data source is present in the top right of the screen dump above.

我们注意到,新共享数据源位于上方屏幕转储的右上方。

At this point, we create a few datasets, the data from which will be utilized to populate the drop down “pick lists” associated with parameters that we shall create within a few minutes.

此时,我们创建了一些数据集,这些数据集将被用于填充与我们将在几分钟之内创建的参数相关联的下拉“选择列表”。

Once again, should you be unfamiliar with creating a dataset within Reporting Services, please do have a look at the above mentioned article where I show you in detail how these datasets may be constructed.

再一次,如果您不熟悉如何在Reporting Services中创建数据集,请查看上面提到的文章,在这里我将向您详细介绍如何构建这些数据集。

For our example, we shall be utilizing only two of the seven attributes, “Color” and “Neck Style”.

对于我们的示例,我们将仅使用七个属性中的两个,即“颜色”和“颈部样式”。

We right click on the “Dataset” folder (see above and to the left) and select “Add Dataset”.

我们右键单击“ Dataset”文件夹(请参见上方和左侧),然后选择“ Add Dataset”。

The “Dataset Properties” dialogue box opens. We shall call our dataset “Color”. We choose the “Use a dataset embedded in my report” (see above). We now click the “New” button located to the right of the “Data source” dialogue box.

“数据集属性”对话框打开。 我们将数据集称为“颜色”。 我们选择“使用报表中嵌入的数据集”(请参见上文)。 现在,我们单击“数据源”对话框右侧的“新建”按钮。

The “Data Source Properties” dialogue box is brought up. We give our local / embedded data source a name and reference this local data source to the “Shared Data Source” that we created a few minutes ago (see above). We click OK to continue.

出现“数据源属性”对话框。 我们为本地/嵌入式数据源命名,并将该本地数据源引用到我们几分钟前创建的“共享数据源”(请参见上文)。 我们单击“确定”继续。

As opposed to creating a Stored Procedure to populate this dataset, we choose to utilize T-SQL as the query is fairly straight forward.

与创建存储过程以填充该数据集相反,我们选择使用T-SQL,因为查询非常简单。


Select distinct ‘_all’ as [Color_Code] from mdm.SQLShack_Products
Union all
Select distinct [Color_Code] from mdm.SQLShack_Products

Clicking the “Fields” tab we see that this dataset will return the “Color_Code” from the view.

单击“字段”选项卡,我们看到此数据集将从视图中返回“ Color_Code”。

We click OK to create the dataset.

我们单击确定以创建数据集。

Our newly created dataset may be seen in the screen dump above.

我们新创建的数据集可以在上面的屏幕转储中看到。

In a similar fashion we create a “Neck Style” dataset as well (see above).

我们也以类似的方式创建“颈部样式”数据集(请参见上文)。

为我们的报告创建一些参数 ( Creating a few parameters for our reporting )

To begin creating the necessary parameters for our new report, we right click upon the “Parameters” folder in the top left of the screen dump above. From the context menu we select “Add Parameter”.

要开始为我们的新报告创建必要的参数,请右键单击上方屏幕转储左上方的“ Parameters”文件夹。 从上下文菜单中,选择“添加参数”。

The “Report Parameter Properties” dialogue box opens. We give our parameter the name “Color” (see above).

“报告参数属性”对话框打开。 我们将参数命名为“颜色”(请参见上文)。

Clicking on the “Available Values” tab, we select the “Get values from a query” option and select the “Color” dataset shown in the “pick list” above.

单击“可用值”选项卡,我们选择“从查询中获取值”选项,然后选择上面“选择列表”中显示的“颜色”数据集。

We set the “Value Field” and the “Label Field” to “Color_Code” (see above). We click OK to exit the dialogue box.

我们将“值字段”和“标签字段”设置为“ Color_Code”(请参见上文)。 我们单击确定退出对话框。

In a similar fashion, we create the “Neck Style” parameter.

以类似的方式,我们创建“颈部样式”参数。

Previewing what we have thus far, we are able to see the “Color” “pick list” that has populated the “Color” parameter box.

预览到目前为止的内容,我们可以看到填充了“颜色”参数框的“颜色”“选择列表”。

The screen shot above shows the values populated by the “Collar Type” dialogue box.

上面的屏幕快照显示了“项圈类型”对话框填充的值。

创建报告的内容 ( Creating the meat of the report )

With the necessary infrastructure now in place, we now proceed to create a dataset to pull the “Product” data.

现在有了必要的基础架构,我们现在继续创建数据集以提取“产品”数据。

The code necessary to pull the data is shown above and the listing is shown below. Please do have a look at the way I have constructed the predicate!!

上面显示了提取数据所需的代码,下面显示了清单。 请看看我构造谓词的方式!!


select [Name],[Cost]
,[Retail Price]
,[Discontinued_Name]
,[Available to Outlet_Name]
,[Type_Name]
,[Fabric_Name]
,[Neck Style_Name]
,[Gender_Name]
,[Size_Name]
,[Color_Name] from [mdm].[SQLShack_Products]
where (1 = (case when @Color = '_all' then 1 else 2 end) OR ([Color_Code] = @Color))
and (1 = (case when @NeckStyle= '_all' then 1 else 2 end) OR ([Neck Style_Code] = @NeckStyle))

Clicking on our “Fields” tab, we see the fields that will be pulled from the Product entity.

单击我们的“字段”选项卡,我们看到将从产品实体中拉出的字段。

We click OK to exit our “Dataset Properties” dialog box and find ourselves back on our work surface.

我们单击“确定”退出“数据集属性”对话框,然后回到工作界面。

Our next task is to add a “Matrix report item” to our work surface.

我们的下一个任务是在工作界面中添加一个“矩阵报告项”。

Dragging a “Matrix Report Item” from the tool box and placing it on our drawing surface, we now connect our matrix to the Product based dataset that we just created (see below and to the right).

从工具箱中拖动“矩阵报告项”并将其放置在我们的绘图面上,现在我们将矩阵连接到刚创建的基于产品的数据集(请参见下面和右边)。

Our next task is to remove the column grouping from our report (see below).

我们的下一个任务是从报告中删除列分组(请参见下文)。

We right click upon the “ColumnGroup” and select “Delete Group” from the context menu.

我们右键单击“ ColumnGroup”,然后从上下文菜单中选择“ Delete Group”。

We are asked if we wish to delete the grouping and the data or merely the grouping only. We select “Delete group only” (see above).

询问我们是否要删除分组和数据,或者仅删除 分组。 我们选择“仅删除组”(请参见上文)。

We now must add a few more columns to the matrix as we note in the screen dump below.

现在我们必须在矩阵中添加更多列,如下面的屏幕转储所示。

By clicking on the Rows ellipsis (see above) the list of the fields available to us are shown in the “pick list” (see above). We assign each field to its own column (see below). We also add a title for our report (see below).

通过单击行省略号(请参见上文),我们可用的字段列表将显示在“选择列表”(请参见上文)中。 我们将每个字段分配给自己的列(请参见下文)。 我们还为报告添加标题(请参见下文)。

Adding a bit of coloring our report, the surface looks as follows.

添加一些颜色给我们的报告,表面看起来如下。

运行我们完成的报告 ( Running our completed report )

We click the “Preview” tab (from the report ribbon). For the color, we select “_all “colors (see above). For the neck style we select “Collared” (see above). The result set is displayed in the matrix above.

我们单击“预览”选项卡(从报告功能区)。 对于颜色,我们选择“ _all”颜色(请参见上文)。 对于颈部样式,我们选择“ Collared”(参见上文)。 结果集显示在上方的矩阵中。

We see the result of all “Purple” items above.

我们看到上面所有“紫色”项目的结果。

结论 ( Conclusions )

Many smaller enterprises have limited resources to create and maintain front end GUI’s to help team members add, modify and delete data (as applicable). .Net development is costly and time intensive in addition to being an over kill for simple requirements (as was the case of our financial client). Working with Master Data Services provides a financially viable option to create quick and dirty user interfaces that may be maintained by the end user, thus freeing up other IT resources.

许多小型企业的资源有限,无法创建和维护前端GUI,以帮助团队成员添加,修改和删除数据(适用时)。 .Net开发不仅成本高昂且耗时,而且对简单的要求也无济于事(就像我们的金融客户一样)。 与主数据服务一起使用在财务上可行,可以创建可由最终用户维护的快速而肮脏的用户界面,从而释放其他IT资源。

This ends our get together for today, HOWEVER as discussed in the introduction it would be super to have your comments as to whether or not you would like me to submit more Master Data Services related articles. I look forward to hearing your feedback.
In the interim, happy programming!!

到此为止我们今天的聚会结束了,但是,如引言中所讨论的那样,对于您是否希望我提交更多与主数据服务相关的文章,发表您的意见将是极好的。 期待收到您的反馈。
在此期间,编程愉快!!

翻译自: https://www.sqlshack.com/using-master-data-services-to-create-gui-maintained-by-end-user/

sql创建表主键gui

sql创建表主键gui_在SQL Server中使用主数据服务快速创建最终用户可以维护的GUI相关推荐

  1. mysql 创建表主键_MySQL创建表和主键约束

    1.创建表 在操作数据表之前,应该使用"USE 数据库名"指定操作是在哪个数据库中进行 主键约束(唯一标识) ****非空*** ****唯一*** ****被引用****(学习外 ...

  2. 用linux命令创建表主键,Linux系统下SQL Server数据库操作

    Linux系统SQL Server数据库操作命令 连接数据库 sqlcmd命令 创建数据库: 查看所有数据库: 创建表 添加主键约束 外部关键字 怎么添加唯一约束 怎么添加非空约束 怎么使用默认约束 ...

  3. SQLServer通过sql修改表主键

    先查询出主键的内码,然后删除该主键 DECLARE @NAME SYSNAME DECLARE @TB_NAME SYSNAMESET @TB_NAME = '表名'SELECT TOP 1 @NAM ...

  4. sql建表+主键+外键

    create table + 名字 ( 列名 + 属性 + (是否可以为空值)[主键不可为空] [主键可以为联合主键,外键中可以出现空值] 主键:primary key 外键:foreign key ...

  5. SQL语句(二)创建带主键和约束的数据表

    内容摘要 创建带主键和约束的表 创建带组合主键和外键的表 1. 创建带主键和约束的表 Student (学生表) CREATE TABLE Student ( sclass varchar(10) N ...

  6. 【转】sql server创建复合主键的2种方法

    创建复合主键: 方法一:创建表之后,alter table table_name add primary key(字段1,字段2) 方法二:CREATE TABLE 表名 (字段名1 Int Not ...

  7. Bootstrap4+MySQL前后端综合实训-Day04-PM【PowerDesigner 图形化数据库设计软件(设置依赖关系、自动增长主键、生成sql语句)、SQLyog软件(备份数据库)】

    [Bootstrap4前端框架+MySQL数据库]前后端综合实训[10天课程 博客汇总表 详细笔记] 目   录 PowerDesigner软件 5张数据表之间的依赖关系图 设置数据表的自动增长主键 ...

  8. mysql联合主键语句6_初探SQL语句复合主键与联合主键

    一.复合主键 所谓的复合主键 就是指你表的主键含有一个以上的字段组成,不使用无业务含义的自增id作为主键. 比如 create table test ( name varchar(19), id nu ...

  9. mysql联合主键_初探SQL语句复合主键与联合主键

    一.复合主键 所谓的复合主键 就是指你表的主键含有一个以上的字段组成,不使用无业务含义的自增id作为主键. 比如 create table test ( name varchar(19), id nu ...

最新文章

  1. 【做题】SRM701 Div1 Hard - FibonacciStringSum——数学和式&矩阵快速幂
  2. 分布式b2b b2c o2o电子商务云平台
  3. 一个 Java 对象到底有多大?
  4. 《Objective-c》Foundation框架 -(NSDate)
  5. SAP云平台cf push命令报错的解决方法
  6. VC6.0背景颜色更改
  7. C++生产和使用的临时对象
  8. PostgreSQL导出导入schema相关
  9. java类加载器和父类委托机制
  10. Python3使用bencode库解析BT种子
  11. 传奇DBC数据库变量详细解释传奇DB文件详解
  12. ps显示暂存盘已满的解决办法
  13. 安理工计算机专业分数线,安徽理工大学复试录取分数线
  14. ARM7、ARM9、ARM11、ARM-Cortex的关系
  15. 用于高速网络的实时且可靠的基于异常的入侵检测
  16. nginx怎么防御DDOS攻击
  17. 【附源码】计算机毕业设计java装修信息分享管理系统设计与实现
  18. 陪玩MM谁是你的NO.1?Python获取陪玩MM照片颜值检测打分
  19. 3G入门教程--通讯基础
  20. Android KitCat 4.4.2 ADB 官方所支持的所有Services格式翻译

热门文章

  1. c++如何解决大数组栈内存不够的问题
  2. hdu 5977 Garden of Eden(点分治+状压)
  3. 碰撞回避算法(一) Velocity Obstacle
  4. SOPC自定义外设(IP)的地址对齐
  5. QString string int double char 相互转化
  6. LeetCode(283)——移动零(JavaScript)
  7. 零基础带你学习MySQL—Update语句以及注意事项(八)
  8. JavaScript学习(四十二)—利用工厂模式创建对象以及工厂模式创建对象的不足
  9. 等响度曲线_等响曲线是如何绘制的?响度级
  10. 老婆给我推荐了一个副业,现在收入高于我工资,我要不要辞职?