Skip to main content

Posts

Showing posts from December, 2017

How to create View using Union query from one database to another database in SQL

To create View using Union query from one database to another database in SQL you can get hints from below example its very simple your column should be the same type and number of the column should be same to create union query view. USE [TestDB] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO Create VIEW [dbo].[Test_FinancialDimension] AS ( SELECT [key_] ,[NAME] ,[Value] FROM MicrosoftDynamicsAX.dbo.dimattributecompanyinfo union SELECT [key_] ,[NAME] ,[Value] FROM MicrosoftDynamicsAX.dbo.DimAttributeOMCostCenter --union -- SELECT [key_] ,[NAME],[Value] FROM MicrosoftDynamicsAX.dbo.DimAttributeHcmWorker union SELECT [key_] ,[NAME] ,[Value] FROM MicrosoftDynamicsAX.dbo.DIMATTRIBUTEOMDEPARTMENT union SELECT [key_] ,[NAME] ,[Value] FROM MicrosoftDynamicsAX.dbo.DimAttributeOMBusin