daily pastebin goal
90%
SHARE
TWEET

Untitled

a guest Sep 13th, 2017 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. INSERT INTO MyTable (
  2.        Col1
  3.       ,Col2 )
  4. OUTPUT DISTINCT -- issue is with DISTINCT
  5.        INSERTED.Col1
  6.       ,@otherParameter
  7.        INTO IdListTable
  8. SELECT ColA
  9.       ,ColB
  10.       ,SUM(ImportantNumber)
  11. FROM MyOtherTable
  12. GROUP BY ColA, ColB
  13.    
  14. INSERT INTO MyTable (
  15.        Col1,
  16.        Col2 )
  17. OUTPUT
  18.        INSERTED.Col1,
  19.        @otherParameter
  20.        INTO #tempIdListTable
  21. SELECT ColA,
  22.        ColB,
  23.        SUM(ImportantNumber)
  24. FROM MyOtherTable
  25. GROUP BY ColA, ColB
  26.  
  27. Insert into IdListTable
  28. Select distinct col1, col2 from #tempIdListTable
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top