amit_pjoshi (7/10/2013)
Lowell (7/10/2013)
instead ofEXEC sp_executesql @sql
use
EXEC(@sql)
which has no limits on the query size, since it's not parameterized. ou are not passing parameters via sp+executesql, so you'd be good to go, i think.
Hi Lowell,
Thanks for your quick response.
Because we are using the link server (OLAP) that will not allow string > 8000 Chars so it will pass the incomplete MDX query to server and give error while EXEC(@sql):
FROM OPENQUERY(OLAP, ''' + @mdx + ''')'
Actually
INSERT INTO #MDXResults
EXECUTE(@mdx) AT OLAP
INSERT #tblData (Lot, Season, [Value], COGS, Units, Delivered, CountryRank, CountryValue, CountryCOGS,
CountryUnits, CountryDelivered, SQM, [Shop Model], [Stock], CountryStocks)
SELECT somecolumns
FROM #MDXResults
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden