...
- If not already open, launch Microsoft SQL Server Management Studio and connect to the SQL server on which Aptify is installed.
- In the Object Explorer, expand the server's Databases heading.
- Select a database on the local server other than APTIFY. You can create a new database also, as necessary.
- The example in this section use a local database called VirtualData.
- The example in this section use a local database called VirtualData.
- Click the New Query button in the toolbar to open a blank SQL query window.
- Enter a SQL statement to create a view of the desired data.
- Specify the Linked Server you created -previously (see External Data Not on Local Server Needs a Linked Server Relationship for details) as the location for this data.
- The following is a sample statement you can use to create the view and grant access to a database role:
- CREATE VIEW [ViewName]
AS
SELECT * FROM [LinkedServerName].[database on
linked server, if
applicable].dbo.[ExternalTableName]
GO
GRANT SELECT ON [ViewName] to [database role]
The statement shown in the figure below will create a view named vwLibraryInventory to display all of the data from the LibraryInventory table, which is located in the EXTERNAL_DATA linked server's Vault database.
- CREATE VIEW [ViewName]
- If creating a view of data stored in Aptify, specify a view name that will not be confused with Aptify's standard naming convention for views (which is, vw[EntityName]).
The following is a sample statement you can use to create the view and grant -access to a database role:
CREATE VIEW [ViewName]
AS
SELECT * FROM APTIFY.dbo.[TableName]
GO
GRANT SELECT ON [ViewName] to [database role]The statement shown in figure below will create a view named vwVirtualProductPrices to display all of the data from Aptify's ProductPrices sub-type entity.
Note For the sake of simplicity, the sample view above grants access to the public database role. However, when creating a database view, you should follow your organization's standard security practices and grant SELECT access only to those roles that require it.
- Specify the Linked Server you created -previously (see External Data Not on Local Server Needs a Linked Server Relationship for details) as the location for this data.
- Execute the SQL statement to create the view in the specified database.
- Close Microsoft SQL Server Management Studio.