Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.
declare @TempTable table ( [Generic Code] nvarchar(1000), NDC nvarchar(1000), [Drug Name] nvarchar(1000), Qty nvarchar(1000) ) Insert Into @TempTable ([Generic Code],NDC,[Drug Name],Qty) select TR.[Generic Code], TR.NDC, TR.[Drug Name], Sum(TR.[Dispensed Qty]) as Qty from TransactionReport TR Group By TR.[Generic Code],TR.NDC,TR.[Drug Name] Insert Into @TempTable ([Generic Code],NDC,[Drug Name],Qty) select Dr.GenericCode as [Generic Code],Dr.Name as [Drug Name],Br.NDC as [NDC],Br.Qty as [Qty] from BalanceReport Br Inner Join Drug Dr on stuff(Dr.DrugNDCNbr,case when Dr.DrugNDCType in (50, 56) then 1 when Dr.DrugNDCType in (51, 57) then 6 when Dr.DrugNDCType = 52 then 10 end, 0, '0') = Br.NDC select [Generic Code],NDC,[Drug Name],Qty from @TempTable
|Restoring Empty Database (without data) from a Database Snapshot||22||53|
|Update foreign key reference after insert||9||30|
|How to manage encyps queries mssql when sending conditioning values||10||21|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
12 Experts available now in Live!