Friday, 24 March 2017

Best Practice SQL, SSAS, SSRS


SQL

1.      Build partitions based on month

2.      Add non clustered index based on month

3.      Add non clustered index based on month + portioning strategy in cube

SSAS

1.      Ensure all reference dimensions are materialized

2.      Only have measures that are used in the cube

3.      Only have attributes in dimensions that are used

4.      Split partitions into 2-20million sizes

5.      Build usage based aggregations based on most common queries

6.      Do not create dynamic sets in cube [Can build measure in background sql to load]

7.      Ensure many to many are <=1 million rows max [latest period only]

 

SSRS

1.      Build MDX efficiently:

a.      Do not have huge sets, build in SSAS

b.      Remove filters – instead have exists or flag attribute in cube

c.      Remove any measures not required in query

d.      Try to push top count into cube

2.      Remove lookups and build into MDX

3.      Remove unnecessary  parameter datasets not required

4.      Try to merge datasets if possible

Thursday, 23 March 2017

SSIS Call a web service

A web service is a method over the network used to share information between applications. Web services are very common these days to retrieve game matches, the weather, stock quotes, etc.
In this tip, we are going to work with a web service that pulls weather information.  To begin with, your server running SSIS must have internet access.

Sample Web Service - Global Weather

  1. Using your browser, open the http://www.webservicex.net/globalweather.asmx web service and click on the "GetWeather" link.

    Integration Service Project

  2. Specify the City and the Country and press the "Invoke" button.

    Integration Service Project

  3. You will be able to see weather information such as wind, temperature and other related information in an XML format.

    Integration Service Project
As you can see, this web service is simple. It is a XML file with results that are published on the web and you can invoke it with your application. Let's retrieve this information using SSIS.

Setting up SSIS package to call a web service

  1. Open SSDT or BIDS and create a new SSIS Project.

    Integration Service Project

  2. Drag and drop the Web Service Task onto the Design pane.

    Integration Service Project

  3. Double click on the Web Service Task and create a new HTTP connection.

    Integration Service Project

  4. In the Server URL textbox, specify the web service address: "http://www.webservicex.net/globalweather.asmx?WSDL" and press the Test Connection button.

    Integration Service Project
  5. Create an empty wsld file.  For this example I created a file called mywsld in the "C:\Webservice" folder.

    Integration Service Project
  6. In the WSDL File property specify the path of the file created in the step 5. Make sure that the OverwriteWSDLFile option is set to true and press the Download WSDL button.

    Integration Service Project

  7. In the Input tab, specify the City and the Country. In this sample, we used New York and United States. Press OK.

    Integration Service Project

  8. In the Output tab, in the File properties, select "New Connection".

    Integration Service Project
  9. Select the "Create file" option in the Usage type.

    Integration Service Project

  10. In the File textbox, specify the path of the file to store the results of the Web Service and press OK. This is the file where the XML data will be written to when the package is run and the web service is called.

    Integration Service Project
  11. Run the SSIS project.

    Integration Service Project
  12. Open the file created in the path specified in step 10 and you can see the XML output that was created from the web service.

    Integration Service Project
As you can see, the process to invoke a Web Service is very simple. If you have any questions, feel free to write your comments and questions below.

SSIS Call Web Method

Create a script task in SSIS and enter the following code: 

public void Main()



{

string url = (string) Dts.Variables["User::URL"].Value;

WebRequest request = HttpWebRequest.Create(url);

WebResponse response = request.GetResponse();

StreamReader reader = new StreamReader(response.GetResponseStream());

string urlText = reader.ReadToEnd();

Dts.TaskResult = (int)ScriptResults.Success;



}

web confir for sharepoint reports

<appSettings>

<!--SSAS Connection string-->

<!--add key="SSASConnection" value="Provider=MSOLAP;Data Source=CDTSOLAP937D.gemini.dev;Initial Catalog=WHSVC_IT_M_IMS_1;Roles=PHOENIX"/-->

<add key="SSASConnection" value="Provider=MSOLAP;Data Source=xxx;Initial Catalog=WHSVC_IT_M_IMS_1;Roles=PHOENIX"/>







<!--Report Default Details-->

<add key="ReportGroup" value="ITALYALD"/>

<add key="ReportDefaultName" value="Strade_Region"/>







<!--Report Server Details-->

<add key="ReportServerPath" value="http://report/_vti_bin/reportserver"/>

<add key="ReportFolder" value="?http://report/SSRS/Italy/IAM/"/>

<add key="ReportExtension" value=".rdl"/><!--If SharePoint integrated use .rdl else blank-->

<!--Show Reporting Toolbars-->

<add key="ReportShowToolbar" value="No"/>

<add key="ReportShowParameterToolbar" value="No"/>







<!--iframe size (e.g. 100%/1400px or "" for full screen) [common: 1200px / 1400px]-->

<add key="iFrameWidth" value="100%"/>

<add key="iFrameHeight" value="1400px"/>







<!--Debug settings (Show errors, etc at top of screen)-->

<add key="DebugShowErrors" value="Yes"/>

<add key="DebugShowParameters" value="No"/>

<add key="DebugShowUser" value="No"/>







<!--Wholesaler query to get the default wholesaler of user logged in-->

<add key="WholesalerQuery" value="WITH MEMBER [Measures].[ParameterCaption] AS [WHOLESALER].[Wholesaler].CURRENTMEMBER.MEMBER_CAPTION MEMBER [Measures].[ParameterValue] AS [WHOLESALER].[Wholesaler].CURRENTMEMBER.UNIQUENAME MEMBER [Measures].[ParameterLevel] AS [WHOLESALER].[Wholesaler].CURRENTMEMBER.LEVEL.ORDINAL SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS ,[Wholesaler].[Wholesaler].DefaultMember ON ROWS FROM [WHS SALES]"/>

<add key="WholesalerParameter" value="WID"/>

<add key="ManuafacturerParameter" value="M"/>

<add key="ProductTypeParameter" value="PT"/>

<add key="ProductParameter" value="P"/>

</appSettings>

<connectionStrings>

<!--Wrapper connection-->

<!--add name="SQLWrapperConfigDB" connectionString="Data Source=cdtssql2027d.gemini.dev;Initial Catalog=WebWrapperConfig;UID=WebConfigWrapper;Password=!@#456@1(" providerName="System.Data.SqlClient"/-->

<add name="SQLWrapperConfigDB" connectionString="Data Source=xxx;Initial Catalog=WebWrapperConfig;UID=user;Passwordxxx" providerName="System.Data.SqlClient"/>

</connectionStrings>