Isnull SQL Query :
SELECT [DB_Staging].[Store].[STIssueDetails].EstateID +[DB_Staging].[Store].[STIssueDetails].[STIssueID] As [JOURNALID]
,[DB_Staging].[Store].[STIssueDetails].[Linenum]
,[DB_Staging].[Store].[STIssueDetails].[STIssueDetailsID] AS Voucher
,[DB_Staging].[Store].[STIssueDetails].[StockID] AS [ITEMID]
,abs([DB_Staging].[Store].[STIssueDetails].[IssuedQty]) * -1 AS [QTY]
,[DB_Staging].[General].[Estate].InventDimID AS INVENTDIMID
,Isnull([DB_Staging].[Store].[STIssueDetails].[COAID],'') as [BIT_MainaccountNum]
,Isnull([DB_Staging].[Store].[STIssueDetails].[CashFlow],'') as [BIT_CASHFLOW]
,isnull([DB_Staging].[Store].[STIssueDetails].[Location],'') as [BIT_LOCATION]
,isnull([DB_Staging].[Store].[STIssueDetails].[Division],'') AS [BIT_DIVISION]
,isnull([DB_Staging].[Store].[STIssueDetails].[YOPid],'') AS [BIT_YOPID]
,isnull([DB_Staging].[Store].[STIssueDetails].[Fields],'') AS [BIT_FIELDS]
,isnull([DB_Staging].[Store].[STIssueDetails].[Vehicle],'') AS [BIT_VEHICLE]
,isnull([DB_Staging].[Store].[STIssueDetails].[Station],'') AS [BIT_STATION]
,isnull([DB_Staging].[Store].[STIssueDetails].[Category],'') AS [BIT_CATEGORY]
,[DB_Staging].[Store].[STIssueDetails].[EstateID] AS BIT_INVENTLOCATIONID
,ABS([DB_Staging].[Store].[STIssueDetails].[IssueUnitPrice]) AS [COSTPRICE]
,ABS([DB_Staging].[Store].[STIssueDetails].[IssuedValue]) * -1 AS [COSTAMOUNT]
,[DB_Staging].[Store].[STIssueDetails].[CreatedBy]
,[DB_Staging].[Store].[STIssueDetails].[ModifiedBy]
,Dateadd(hour, -7, [DB_Staging].[Store].[STIssueDetails].[CreatedOn]) as [Transdate]
,Dateadd(hour, -7, [DB_Staging].[Store].[STIssueDetails].[ModifiedOn]) AS [MODIFIEDDATETIME]
,dateadd(hour, -7, [DB_Staging].[Store].[STIssueDetails].[CreatedOn]) AS [CREATEDDATETIME]
,dateadd(hour, -7, [DB_Staging].[Store].[STIssueDetails].[CreatedOn]) AS [INTRASTATFULFILLMENTDATE_HU]
,'1900-01-01 00:00:00.000' AS [RELEASEDATE]
,[DB_Staging].[Store].[STIssueDetails].[DataAreaId]
,[DB_Staging].[Store].[STIssueDetails].[RECID] AS RECID
FROM [DB_Staging].[Store].[STIssueDetails]
inner join [DB_Staging].[General].[Estate]
on [DB_Staging].[General].[Estate].EstateID = [DB_Staging].[Store].[STIssueDetails].EstateID
SELECT [DB_Staging].[Store].[STIssueDetails].EstateID +[DB_Staging].[Store].[STIssueDetails].[STIssueID] As [JOURNALID]
,[DB_Staging].[Store].[STIssueDetails].[Linenum]
,[DB_Staging].[Store].[STIssueDetails].[STIssueDetailsID] AS Voucher
,[DB_Staging].[Store].[STIssueDetails].[StockID] AS [ITEMID]
,abs([DB_Staging].[Store].[STIssueDetails].[IssuedQty]) * -1 AS [QTY]
,[DB_Staging].[General].[Estate].InventDimID AS INVENTDIMID
,Isnull([DB_Staging].[Store].[STIssueDetails].[COAID],'') as [BIT_MainaccountNum]
,Isnull([DB_Staging].[Store].[STIssueDetails].[CashFlow],'') as [BIT_CASHFLOW]
,isnull([DB_Staging].[Store].[STIssueDetails].[Location],'') as [BIT_LOCATION]
,isnull([DB_Staging].[Store].[STIssueDetails].[Division],'') AS [BIT_DIVISION]
,isnull([DB_Staging].[Store].[STIssueDetails].[YOPid],'') AS [BIT_YOPID]
,isnull([DB_Staging].[Store].[STIssueDetails].[Fields],'') AS [BIT_FIELDS]
,isnull([DB_Staging].[Store].[STIssueDetails].[Vehicle],'') AS [BIT_VEHICLE]
,isnull([DB_Staging].[Store].[STIssueDetails].[Station],'') AS [BIT_STATION]
,isnull([DB_Staging].[Store].[STIssueDetails].[Category],'') AS [BIT_CATEGORY]
,[DB_Staging].[Store].[STIssueDetails].[EstateID] AS BIT_INVENTLOCATIONID
,ABS([DB_Staging].[Store].[STIssueDetails].[IssueUnitPrice]) AS [COSTPRICE]
,ABS([DB_Staging].[Store].[STIssueDetails].[IssuedValue]) * -1 AS [COSTAMOUNT]
,[DB_Staging].[Store].[STIssueDetails].[CreatedBy]
,[DB_Staging].[Store].[STIssueDetails].[ModifiedBy]
,Dateadd(hour, -7, [DB_Staging].[Store].[STIssueDetails].[CreatedOn]) as [Transdate]
,Dateadd(hour, -7, [DB_Staging].[Store].[STIssueDetails].[ModifiedOn]) AS [MODIFIEDDATETIME]
,dateadd(hour, -7, [DB_Staging].[Store].[STIssueDetails].[CreatedOn]) AS [CREATEDDATETIME]
,dateadd(hour, -7, [DB_Staging].[Store].[STIssueDetails].[CreatedOn]) AS [INTRASTATFULFILLMENTDATE_HU]
,'1900-01-01 00:00:00.000' AS [RELEASEDATE]
,[DB_Staging].[Store].[STIssueDetails].[DataAreaId]
,[DB_Staging].[Store].[STIssueDetails].[RECID] AS RECID
FROM [DB_Staging].[Store].[STIssueDetails]
inner join [DB_Staging].[General].[Estate]
on [DB_Staging].[General].[Estate].EstateID = [DB_Staging].[Store].[STIssueDetails].EstateID
0 comments:
Post a Comment