Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Getting an unclear error in OLE DB source

$
0
0

Hi,

I have the following sql code that works fine in SSMS, but when I am inserting it to the SSIS OLE DB source, I am getting the following error:

No column information was returned by the SQL command.

The SQL is:

if object_id('tempdb..#Mutavim') is not null drop table #Mutavim

select a.*
into #Mutavim
from(

SELECT  [M3MHOZ]
      ,[M3MKOR]
      ,[M3ANAF]
      ,[M3POLS]
      ,[M3TOSF]
      ,[M3NO]
      ,replace(replace(replace(ltrim(rtrim([M3MLL])),' ','<>'),'><',''),'<>',' ') as [M3MLL]
      ,[M3SEIF]
  FROM [ODS_ELEMENTAR].[dbo].[ODS_Y2ECOGNUS_CGMDA03F]
  where [M3NO]<=4 ) as a

inner join

(
SELECT  [M3MHOZ]
      ,[M3MKOR]
      ,[M3ANAF]
      ,[M3POLS]
      ,max([M3TOSF]) as [M3TOSF]
  FROM [ODS_ELEMENTAR].[dbo].[ODS_Y2ECOGNUS_CGMDA03F]
  where [M3NO]<=4
  group by  [M3MHOZ]
      ,[M3MKOR]
      ,[M3ANAF]
      ,[M3POLS]) b
  on a.[M3MHOZ]=b.[M3MHOZ]
     and  a.[M3MKOR]=b.[M3MKOR]
     and  a.[M3ANAF]=b.[M3ANAF]
      and a.[M3POLS]=b.[M3POLS]
      and a.[M3TOSF]=b.[M3TOSF]


SELECT
[1] as Mutav_1, [2]  as Mutav_2, [3]  as Mutav_3, [4]  as Mutav_4
      ,[M3MHOZ]
      ,[M3MKOR]
      ,[M3ANAF]
      ,[M3POLS]
      ,[M3SEIF]

FROM
(SELECT M3NO, M3MLL , [M3MHOZ]
      ,[M3MKOR]
      ,[M3ANAF]
      ,[M3POLS]
      ,[M3SEIF]
    FROM #Mutavim) AS Mutavim
PIVOT
(
max(M3MLL)
FOR M3NO IN ([1], [2], [3], [4])
) AS PivotTable;

What needs to be changed in order for it to work ?

Thanks,

Dani



Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>