EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB45808: Different kind of temporary table generated by SQL Server 2012 as compared to SQL server 2008


Community Admin

• Strategy


SYMPTOM
In Strategy 9.4.1 and later, when the ‘Intermediate Table Type’ VLDB property is set to ‘True Temporary table’, global temporary tables are generated for SQL Server 2012; while local temporary tables are generated for SQL Server 2008. The global temporary tables are prefixed by ## while the local temporary tables are prefixed by #.
STEPS TO REPRODUCE:

  1. Create a simple report with attribute Brand in row, and metric Cost and Freight in column.
  2. Execute the report and check the SQL view.

SQL Server 2008:
Temp table starts with #ZZ as shown below:


select a12.BRAND_ID  BRAND_ID,
sum(a11.TOT_COST)  WJXBFS1
into #ZZSP00
from ITEM_MNTH_SLS a11
join LU_ITEM a12
on  (a11.ITEM_ID = a12.ITEM_ID)
group by a12.BRAND_ID

select a13.BRAND_ID  BRAND_ID,
sum(((a11.FREIGHT * a12.QTY_SOLD) / a11.QTY_SOLD))  WJXBFS1
into #ZZSP01
from ORDER_FACT a11
join ORDER_DETAIL a12
on  (a11.ORDER_ID = a12.ORDER_ID)
join LU_ITEM a13
on  (a12.ITEM_ID = a13.ITEM_ID)
group by a13.BRAND_ID

select pa11.BRAND_ID  BRAND_ID,
a13.BRAND_DESC  BRAND_DESC,
pa11.WJXBFS1  WJXBFS1,
pa12.WJXBFS1  WJXBFS2
from #ZZSP00 pa11
join #ZZSP01 pa12
on  (pa11.BRAND_ID = pa12.BRAND_ID)
 join LU_BRAND a13
 on  (pa11.BRAND_ID = a13.BRAND_ID)
drop table #ZZSP00
drop table #ZZSP01


SQL Server 2012:
Temp table starts with ##ZZ as shown below:

select a12.BRAND_ID  BRAND_ID,
sum(a11.TOT_COST)  WJXBFS1
into ##ZZSP00
from ITEM_MNTH_SLS a11
join LU_ITEM a12
on  (a11.ITEM_ID = a12.ITEM_ID)
group by a12.BRAND_ID

select a13.BRAND_ID  BRAND_ID,
sum(((a11.FREIGHT * a12.QTY_SOLD) / a11.QTY_SOLD))  WJXBFS1
into ##ZZSP01
from ORDER_FACT a11
join ORDER_DETAIL a12
on  (a11.ORDER_ID = a12.ORDER_ID)
join LU_ITEM a13
on  (a12.ITEM_ID = a13.ITEM_ID)
group by a13.BRAND_ID

select pa11.BRAND_ID  BRAND_ID,
a13.BRAND_DESC  BRAND_DESC,
pa11.WJXBFS1  WJXBFS1,
pa12.WJXBFS1  WJXBFS2
from ##ZZSP00 pa11
join ##ZZSP01 pa12
on  (pa11.BRAND_ID = pa12.BRAND_ID)
join LU_BRAND a13
on  (pa11.BRAND_ID = a13.BRAND_ID)
drop table ##ZZSP00
drop table ##ZZSP01


CAUSE
This is by design. This change was made for SQL Server 2012 because parameterized queries cannot be executed against local temporary tables while they can be executed successfully against global temporary tables using the SQL Server Native Client Driver.
WORKAROUND
Contact Strategy Technical Support if there is a need to change the behavior for SQL Server 2012 to use local temporary tables.
Refer to the following technical note for intstructions to obtain and install PDS objects provided by Strategy Technical Support:KB43537: How to install DBMS objects provided by MicroStrategy Technical Support


Comment

0 comments

Details

Knowledge Article

Published:

May 22, 2017

Last Updated:

May 22, 2017