Quantcast
Channel: SQL Server Analysis Services Forum
Viewing all articles
Browse latest Browse all 2472

SQL Insert row fails when OpenRowset MDX returns nothing, why??

$
0
0

Hi,

How come in the query below when the MDX does not return anything even the SQL Insert into the temp table does not work? Shouldn't it at least add the row with 'Hello Kitty' and the measure value empty?

Instead it is just an empty set. Why does insert fail here?

CREATE TABLE #TEMP(HK VARCHAR(200), M VARCHAR(20))

INSERT INTO #TEMP

SELECT 'Hello Kitty' HK, CONVERT(VARCHAR(MAX), "[Measures].[The Measure]") M
FROM OPENROWSET('MSOLAP','DataSource=Server;Initial Catalog=Cat', 
'SELECT NONEMPTY({[Measures].[The Measure]}) ON 0,
FILTER({NONEMPTY({[The Dimension].[Dimension].[Dim]})}, 
[Measures].[The Measure] <> 0 ).ITEM(0) ON 1
FROM CUBE')

SELECT * FROM #TEMP
DROP TABLE #TEMP

Can it be forced to insert the row if OpenRowset returns nothing?

I did try a CASE WHEN IS NULL on the measure field, and still did not work.

Thanks!!


--ACG


Viewing all articles
Browse latest Browse all 2472

Trending Articles



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