<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>MS-Tech learning with Prasant</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/ms-tech_learning_with_prasant/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/ms-tech_learning_with_prasant/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:25:25 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>SSIS and SSRS upgradation process</title>
      <link>https://docs.microsoft.com/archive/blogs/ms-tech_learning_with_prasant/ssis-and-ssrs-upgradation-process</link>
      <pubDate>Tue, 29 Aug 2017 04:36:23 GMT</pubDate>
      <dc:creator><![CDATA[Prasant Nanda]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ms-tech_learning_with_prasant/?p=276</guid>
      <description><![CDATA[With the introduction of new MSBI versions, we get excited with new features and love to be upgraded...]]></description>
      <content:encoded><![CDATA[With the introduction of new MSBI versions, we get excited with new features and love to be upgraded with latest. But it’s not that easy to upgrade our ecosystem of MSBI applications. Below are few options to do the tech refresh (either version up-gradation or migrating to new environment with different version of application).
<ol>
 	<li>In place – In this option, we keep the same physical system (hardware) and upgrade the software versions and upgrade the applications. During this time (software up-gradation in main system), the MSBI applications go offline.</li>
 	<li>Side-by-side – In this option, we keep the existing system as is and get a new system with desired version and do the applications up-gradation and deploy to the new system. Once verification of new system completes, we make the new as primary system and decommission the old system.</li>
</ol>
SSIS 2014 supports both package and project deployment mode. Below are the brief features of both deployment mode.

<u>Project deployment mode</u>
<ol>
 	<li>The packages are treated as part of a project and they are linked to the project and properties.</li>
 	<li>This mode needs a special database SSISDB, to be used for deployment and execution. We cannot deploy packages as part of file system.</li>
 	<li>The packages are deployed as a project instead of individual packages. All or none package deployment happen in this option. We cannot deploy selective packages (in SSIS 2016, even projects can deploy individual packages i.e. added feature of selectivity).</li>
 	<li>The packages can share project properties, parameters, connections etc.</li>
</ol>
<u>Package deployment mode</u>
<ol>
 	<li>Even packages are part of a project they are maintained individually.</li>
 	<li>The packages can be deployed either in database (msdb) or file system.</li>
 	<li>The advantage of file system deployment is, we can have separate maintenance strategy of packages than database.</li>
</ol>
Please refer online <a href="https://docs.microsoft.com/en-us/sql/integration-services/packages/deploy-integration-services-ssis-projects-and-packages">material</a> for more details and comparison of above modes.

We are discussing the scenario of version up-gradation of MSBI version 2008r2 to 2014 (package deployment mode).We are using the option of side-by-side up-gradation. The prerequisite is SSDT for VS 2015 to be installed.

Step 1 – Get the final source codes of BI applications.
Step 2 – Prepare new solution/project for respective old application. We can use the old solution also, but if we need to keep a separate version of solution, this step is needed.
Step 3 – Verify the SSIS packages and SSRS reports.
Step 4 – Prepare for build and release plan.

<strong>Detailed process mentioned as below</strong>
<ol>
 	<li>We should use proper version of BI editor which matches with our target version, otherwise, we will face run time issues while deploying the code.</li>
 	<li>Since we are using the TFS with VS 2015, the team used VS 2015 to open the SSIS and SSRS packages to add them in TFS. When we open packages and reports in VS 2015 (it will prompt for auto-upgrade to new version), they by default refer the latest version of SQL 2016. But our target is 2014. This creates a problem when we run the SSIS packages or SSRS reports.</li>
 	<li>We should create a new project in VS 2015 and change the project target version property to use proper version i.e. in our case SQL 2014 for SSIS packages.</li>
 	<li><a href="https://msdnshared.blob.core.windows.net/media/2017/08/TargetVersionSelection1.jpg"><img width="300" height="150" class="alignnone size-medium wp-image-296" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/08/TargetVersionSelection1-300x150.jpg" /></a></li>
 	<li>Now we need to add the required SSIS packages which need to be up-graded to the new project. If we have many packages, it will be difficult to add them one by one. We can edit the project file and add the package name. We can use command prompt to get the package names and then use MS Excel to add the required other values needed to complete the project file with all the package names.</li>
 	<li>Now we need to open the packages and check for any error.</li>
 	<li>If the target version is SQL 2016, the VSTA version would be 14. But in our case the target is SQL 2014, so we need to downgrade the target to SQL 2014 and it has VSTA version 3.</li>
 	<li>We may not be in risk if the package does not have any script task or script component.</li>
 	<li>We can open the package file in notepad and search for tag VSTA and verify the version.</li>
 	<li><a href="https://msdnshared.blob.core.windows.net/media/2017/08/VSTA_Version_Change.jpg"><img width="300" height="245" class="alignnone size-medium wp-image-287" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/08/VSTA_Version_Change-300x245.jpg" /></a></li>
 	<li>When we change the target version from 2016 to 2014, we get error for script task and script component.</li>
 	<li>When we open the script task , we observe the readonly and readwrite variables are blank. The script component, is not editable. So need to rewrite them, by taking the code from original file.</li>
 	<li>For SSRS reports, we need to create a new project and change the target to appropriate version.</li>
 	<li><a href="https://msdnshared.blob.core.windows.net/media/2017/08/SSRS_Version_Select.jpg"><img width="300" height="170" class="alignnone size-medium wp-image-305" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/08/SSRS_Version_Select-300x170.jpg" /></a></li>
 	<li>Now we can add the data source (rds) and report (rdl) files.</li>
 	<li>Verify the reports.</li>
 	<li>If we open the reports in VS 2015, we can find a tag in the report with 2016 version. xmlns="https://schemas.microsoft.com/sqlserver/reporting/2016/01/</li>
 	<li>We need to build the project and go to the bin folder and get the rds and rdl files which would be referring to 2010.</li>
 	<li>These are the ones (rds and rdl files) to be deployed in the target system.</li>
</ol>
&nbsp;

<span style="text-decoration: underline"><strong>Executing parent child SSIS packages</strong></span>

&nbsp;
<ol>
 	<li>Creating Parent Child relationship
<ol>
 	<li>We can create a parent package and call other package as child (by referring execute package task in control file).</li>
 	<li>But in this way we cannot use the child’s own external configuration (xml) file. We need to add all the child’s configured values to the parent’s and from child package, we need to use parent package variable configuration option.</li>
 	<li>This way we are tightly coupling the packages and the child cannot run independently.</li>
</ol>
</li>
 	<li>Dynamically loading the package and its config file.
<ol>
 	<li>We can have a script task and pass the package name and config names as variables.</li>
 	<li>In this way, we can write code for loading package with configuration file. Refer the links for details. <a href="https://stackoverflow.com/questions/273751/how-to-execute-an-ssis-package-from-net">Link1</a>, <a href="https://www.codeproject.com/Tips/658959/Execute-SSIS-Packge-by-using-Csharp-and-SQL-Server">Link2</a>, <a href="https://docs.microsoft.com/en-us/sql/integration-services/run-manage-packages-programmatically/loading-and-running-a-local-package-programmatically">Link3</a>.</li>
 	<li>We could not get the proper log for the child package.</li>
</ol>
</li>
 	<li>Using a batch file
<ol>
 	<li>Batch file inside parent package.
<ol>
 	<li>We need to use execute process instead of execute package.</li>
 	<li>The batch file will have the package name and the config file.</li>
</ol>
</li>
 	<li>Batch file as a wrapper (powershell script can be used for better handling).
<ol>
 	<li>We need to create a single batch file which calls the packages in order.</li>
 	<li>In this way there is no relationship maintained.</li>
 	<li>We can use if else condition to make sure one package need to be run only when the other succeeds.</li>
</ol>
</li>
</ol>
</li>
</ol>
Hope it helps you to upgrade applications with desired MSBI versions.

Note : If the target version is SQL 2016 for us, we may not need to do all the above conversions. But still need to verify the VSTA scripts in SSIS package to verify the c# / VB codes. It might happen certain framework related code may be unsupported with new versions.]]></content:encoded>
    </item>
    <item>
      <title>Usage of shared resources on Azure (WAP)</title>
      <link>https://docs.microsoft.com/archive/blogs/ms-tech_learning_with_prasant/usage-of-shared-resources-on-azure</link>
      <pubDate>Tue, 24 May 2016 20:34:40 GMT</pubDate>
      <dc:creator><![CDATA[Prasant Nanda]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ms-tech_learning_with_prasant/?p=145</guid>
      <description><![CDATA[Here we are going to discuss regarding the usage of shared resources which are available on premise,...]]></description>
      <content:encoded><![CDATA[Here we are going to discuss regarding the usage of shared resources which are available on premise, to be accessed on Azure.

<strong>What is shared resource?</strong>
The resource (hardware, software etc.) which is created once and can be accessed by other systems / processes remotely multiple times.

Here we are discussing about printer, shared physical directory. Since the environment is Windows AzurePack (WAP), where we dont have flexibility to use azure storage as of now. The below mention approach can be extended for usage of other third party services like (SSIS package, on demand services etc).

By using Azure storage, it is easy to store the objects for further processing by on-prem services. This is out of scope for the discussion.

<strong>Printer</strong> -
Here is the scenario. Consider an organisation where it is not allowed to installed printer driver at each end user's machine. The printing is allowed based on user level security. This can be termed as printer as service. The user can get access to the printer based on authorization.

The end user can view a report and chooses to print the same. The application verifies the user permission and queue the printing request.

In this way, all the user's print request will be maintained by a queue and print operation will be performed by a central printing device.

In our example of Customer Transaction system, we have a common utility assembly which has the logic for the analysis, reporting of customer transactions. For a particular type of report there is a method which accepts 3 parameters like FromDt, ToDt and TranasactionType.

When user fetches report on UI this assembly gets the data and the report is rendered on UI and user can request print option (not the one available as part of browser) provided by the application.

To achieve this, we are discussing 2 approaches.

1. <strong>Use of Database</strong> - (will not include here any sample code to process)
a. Since in WAP environment we can access on-prem database, we can store the report parameters in the table.
b. We can reuse the common assembly to separate the report rendering and printing process.
c. When the user selects print option on UI, the parameters which are chosen by the user need to be stored on database table.
d. A windows service which runs on on-prem environment, will refer the database table and start the printing operation based on the parameters saved.
e. In this way we can have good audit of the printing operation like which user uses the service, how many times, what prints etc.
f. We will be having good control over all the operations even in case of any hardware failure like printer, on-prem service etc.

2. <strong>Use of Azure service bus</strong>
a. We can use either Topic or Queue to pass the message from Azure to on-prem services.
b. We need to configure the message validity.

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/PrintProcess.jpg"><img class="alignnone size-medium wp-image-155" src="https://msdnshared.blob.core.windows.net/media/2016/05/PrintProcess-294x300.jpg" alt="PrintProcess" width="294" height="300" /></a>

Sample code by using the Azure service bus (Topic in our case).
1. Create a service bus on Azure portal.
2. Get the connection information from the azure portal for the service bus.
3. In the web site add nuget package for service bus and add the connection information as part of the config.

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/Config.jpg"><img class="alignnone wp-image-156 size-medium" src="https://msdnshared.blob.core.windows.net/media/2016/05/Config-300x20.jpg" alt="Config" width="300" height="20" /></a>

Use below namespaces to refer service bus

using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
using Microsoft.Azure;

4. Sender code.

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/Send_Code.jpg"><img class="alignnone size-medium wp-image-165" src="https://msdnshared.blob.core.windows.net/media/2016/05/Send_Code-300x203.jpg" alt="Send_Code" width="300" height="203" /></a>

Here Setting the properties and pass the object as message to the subscriber.

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/Msg_Send.jpg"><img class="alignnone size-medium wp-image-175" src="https://msdnshared.blob.core.windows.net/media/2016/05/Msg_Send-300x64.jpg" alt="Msg_Send" width="300" height="64" /></a>

5. We are using a windows service to receive the message from azure and do further data processing.

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/Receive_Code.jpg"><img class="alignnone size-medium wp-image-185" src="https://msdnshared.blob.core.windows.net/media/2016/05/Receive_Code-300x170.jpg" alt="Receive_Code" width="300" height="170" /></a>

6. When we run the windows service, each time we get one message and we can process that.

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/Msg_Receive.jpg"><img class="alignnone size-medium wp-image-195" src="https://msdnshared.blob.core.windows.net/media/2016/05/Msg_Receive-300x141.jpg" alt="Msg_Receive" width="300" height="141" /></a>

7. Once we get the object at on-prem environment, we can use them based on our need.

8. The printing logic is out of scope of this blog.

<strong> Physical Directory</strong>

By adopting any of the approach mentioned above, we can use on-prem physical directory to save any file uploaded by end user by using azure web site.
<ol>
 	<li>We need to convert the file to binary stream and either store in database table or pass as an object by the service bus to the local service.</li>
 	<li>We need various properties like name of the file, type of file, destination location (optional) and the binary of the file.</li>
 	<li>The local service will create the file at remote server with the properties.</li>
 	<li>We can do further processing once it is available at local service.</li>
</ol>]]></content:encoded>
    </item>
    <item>
      <title>HttpWebRequest POST method Err. The underlying connection was closed</title>
      <link>https://docs.microsoft.com/archive/blogs/ms-tech_learning_with_prasant/httpwebrequest-post-method-err-the-underlying-connection-was-closed</link>
      <pubDate>Thu, 14 May 2015 06:58:00 GMT</pubDate>
      <dc:creator><![CDATA[Prasant Nanda]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ms-tech_learning_with_prasant/2015/05/14/httpwebrequest-post-method-err-the-underlying-connection-was-closed/</guid>
      <description><![CDATA[Currently I faced an issue while posting an xml file through the 3rd party web service. I used...]]></description>
      <content:encoded><![CDATA[<p>Currently I faced an issue while posting an xml file through the 3rd party web service. I used HttpWebRequest to access the web service (Rest Based), but was getting error "The underlying connection was closed: An unexpected error occurred on a send."</p>
<p>I used the fiddler tool to analyze the internal of request, but strange the code started working. I was happy. I stopped the Fiddler tool and went to the code and re-executed. It stopped working and gave me same error. Was there something magic done by Fiddler tool?</p>
<p>I was using a web application and by clicking of a button the file had&nbsp;to be posted. Then I found something interesting that the Fiddler tool was using a proxy. But I could not find the proxy details from the internet explorer -&gt;&nbsp;tool -&gt; settings-&gt; Connection -&gt; LAN Settings. But I could see option for "Use automatic configuration script" and a link <a href="https://pac.xxxxxx.net/">https://pac.xxxxxx.net/</a>.</p>
<p>The PAC (Proxy Auto Config) file defines the way bowsers use the proxy. I just clicked the link and it prompts to save the file. I saved it and opened with notepad and hurrey got the proxy details with port number. Below is the complete code to be used in the Button Click event. Once clicked, the xml file will be posted and the response (xml in my case) would be shown in a text box.</p>
<p>string username = "username";<br />string password = "Password";</p>
<p><br />HttpWebRequest req = null;<br />HttpWebResponse res = null;</p>
<p>const string url = "<a href="https://mytestlink/">https://myTestLink</a>";<br />req = (HttpWebRequest)WebRequest.Create(url);<br />String encoded = System.Convert.ToBase64String(Encoding.Default.GetBytes(username + ":" + password));<br />req.Headers.Add("Authorization", "Basic " + encoded);<br />req.Method = "POST";<br />req.ContentType = "application/xml; charset=utf-8";<br />req.Timeout = 30000;</p>
<p>req.Headers.Add("SOAPAction", url);</p>
<p>// proxy details<br />req.Proxy = new WebProxy("proxy.xxx.com", 8080);<br />req.KeepAlive = true;</p>
<p>var xmlDoc = new XmlDocument { XmlResolver = null };<br />xmlDoc.Load(@"C:\Users\test\Desktop\myTest.xml");<br />string sXml = xmlDoc.InnerXml;</p>
<p>req.ContentLength = sXml.Length;</p>
<p>var sw = new StreamWriter(req.GetRequestStream());<br />sw.Write(sXml);<br />sw.Close();</p>
<p>res = (HttpWebResponse)req.GetResponse();<br />Stream responseStream = res.GetResponseStream();<br />var streamReader = new StreamReader(responseStream);</p>
<p>//Read the response into an xml document<br />var soapResonseXmlDocument = new XmlDocument();<br />soapResonseXmlDocument.LoadXml(streamReader.ReadToEnd());</p>
<p>TextBox1.Text = soapResonseXmlDocument.InnerXml;</p>]]></content:encoded>
    </item>
    <item>
      <title>SSIS Encrypt and Decrypt Connection String</title>
      <link>https://docs.microsoft.com/archive/blogs/ms-tech_learning_with_prasant/ssis-encrypt-and-decrypt-connection-string</link>
      <pubDate>Tue, 17 Mar 2015 22:40:00 GMT</pubDate>
      <dc:creator><![CDATA[Prasant Nanda]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ms-tech_learning_with_prasant/2015/03/17/ssis-encrypt-and-decrypt-connection-string/</guid>
      <description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sometimes it is...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;<span style="font-family: 'Arial','sans-serif'; color: black; font-size: 9pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-family: 'Arial','sans-serif'; color: black; font-size: 10pt;">Sometimes it is needed to secure the connection string which we use in SSIS package. Even we store the connection string in sql server database as config, the users who has access to the config table, can read the connection string. In order to secure it, we should encrypt the connection string and store it in sql config table. In this way it will not be human readable form. It is secure as the person who encrypts the string may not have access to prod environment (in prod environment DBAs will do data update). We may need to consider that the .net framework version&nbsp;should same&nbsp;in the environments where the encryption is happening and where it will be decrypted (the SSIS package run environment).</span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: 'Arial','sans-serif'; color: black; font-size: 10pt;">Below are the steps to do for securing the connection string.</span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: 'Arial','sans-serif'; color: black; font-size: 10pt;">1. Create a reusable library (.dll). In this way the library file can be used with other SSIS package or .net code.</span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: 'Arial','sans-serif'; color: black; font-size: 10pt;">2. Register it.</span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-family: 'Arial','sans-serif'; color: black; font-size: 10pt;">3. Refer in SSIS package.</span></p>
<p style="margin: 0in 0in 0pt;">&nbsp;</p>
<p style="margin: 0in 0in 0pt;"><strong><span style="text-decoration: underline;">Create a reusable library</span></strong></p>
<p style="margin: 0in 0in 0pt;">&nbsp;Open a .net class library type project. <br />&nbsp;Create a class</p>
<p>&nbsp; public class EncryptDecrypt<br />&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public string StringToEncrypt { get; set; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public string SecretKey { get; set; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public string StringToDecrypt { get; set; }<br />&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public string GetEncryptedString()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string strEncryptedString;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte[] clearBytes = System.Text.Encoding.Unicode.GetBytes(StringToEncrypt);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PasswordDeriveBytes pdb = new PasswordDeriveBytes(SecretKey, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 });<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte[] encryptedData = Encrypt(clearBytes, pdb.GetBytes(32), pdb.GetBytes(16));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strEncryptedString = Convert.ToBase64String(encryptedData);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return strEncryptedString;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p style="margin: 0in 0in 0pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public string GetDecryptedString()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string strDecryptedString;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte[] cipherBytes = Convert.FromBase64String(StringToDecrypt);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PasswordDeriveBytes pdb = new PasswordDeriveBytes(SecretKey, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 });<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte[] decryptedData = Decrypt(cipherBytes, pdb.GetBytes(32), pdb.GetBytes(16));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strDecryptedString = System.Text.Encoding.Unicode.GetString(decryptedData);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return strDecryptedString;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private static byte[] Encrypt(byte[] clearText, byte[] Key, byte[] IV)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MemoryStream ms = new MemoryStream();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Rijndael alg = Rijndael.Create();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alg.Key = Key;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alg.IV = IV;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CryptoStream cs = new CryptoStream(ms, alg.CreateEncryptor(), CryptoStreamMode.Write);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cs.Write(clearText, 0, clearText.Length);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cs.Close();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte[] encryptedData = ms.ToArray();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return encryptedData;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private static byte[] Decrypt(byte[] cipherData, byte[] Key, byte[] IV)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MemoryStream ms = new MemoryStream();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Rijndael alg = Rijndael.Create();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alg.Key = Key;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alg.IV = IV;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CryptoStream cs = new CryptoStream(ms, alg.CreateDecryptor(), CryptoStreamMode.Write);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cs.Write(cipherData, 0, cipherData.Length);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cs.Close();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte[] decryptedData = ms.ToArray();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return decryptedData;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;}</p>
<p style="margin: 0in 0in 0pt;">&nbsp;</p>
<p><strong><span style="text-decoration: underline;">Register the .dll file</span></strong></p>
<p><strong></strong>Please follow the steps mentioned&nbsp;(<a href="https://microsoft-ssis.blogspot.com/2011/05/referencing-custom-assembly-inside.html">https://microsoft-ssis.blogspot.com/2011/05/referencing-custom-assembly-inside.html</a>)&nbsp;to sign the dll with strong name key.</p>
<p><strong><span style="text-decoration: underline;">Refer in SSIS package</span></strong></p>
<p>1.&nbsp;Create a variable in SSIS package. This variable should be configured to get data from sql config table at runtime.<br />2.&nbsp;Don&rsquo;t config (through properties -&gt; expression) the connection manager to refer this variable for connection string. If we config this way, the connection manager will throw error at runtime as it will get the encrypted string.<br />3.&nbsp;Place a script task at the beginning of the Control Flow. <br />4.&nbsp;Once the dll is registered, we can refer that in the script task.<br />5.&nbsp;Before the main process start, add a script task and refer the .dll file.<br />6.&nbsp;Create an object of the class and assign the properties with appropriate values.<br />7.&nbsp;Below is the code to assign the decrypted value to the connection manager.</p>
<p>public void Main()<br />{<br />&nbsp;&nbsp;&nbsp; // TODO: Add your code here</p>
<p>ConnectionManager oCon;<br />&nbsp;&nbsp;&nbsp; string strEncryptedConnStr;<br />&nbsp;&nbsp;&nbsp; string strDecryptedConnStr;</p>
<p>&nbsp;&nbsp;&nbsp; EncryptDecrypt ed = new EncryptDecrypt();</p>
<p>&nbsp;&nbsp;&nbsp; ed.SecretKey = "MySecretkey";</p>
<p>&nbsp;&nbsp;&nbsp; strEncryptedConnStr = Dts.Variables["User::varTeradataConnStr_str"].Value.ToString();<br />&nbsp;&nbsp;&nbsp; ed.StringToDecrypt = strEncryptedConnStr;<br />&nbsp;&nbsp;&nbsp; strDecryptedConnStr = ed.GetDecryptedString();</p>
<p>&nbsp;&nbsp;&nbsp; oCon = Dts.Connections["ADONET_CONN-Teradata"];<br />&nbsp;&nbsp;&nbsp; oCon.ConnectionString = strDecryptedConnStr;</p>
<p>&nbsp;&nbsp;&nbsp; Dts.TaskResult = (int)ScriptResults.Success;<br />}</p>
<p>In this way (one of the ways which I tried)&nbsp;the connection string can be secured and decrypted at the time of running the SSIS package.</p>]]></content:encoded>
    </item>
    <item>
      <title>Scheduling job on SQL Azure</title>
      <link>https://docs.microsoft.com/archive/blogs/ms-tech_learning_with_prasant/scheduling-job-on-sql-azure</link>
      <pubDate>Wed, 09 Jul 2014 06:18:00 GMT</pubDate>
      <dc:creator><![CDATA[Prasant Nanda]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ms-tech_learning_with_prasant/2014/07/09/scheduling-job-on-sql-azure/</guid>
      <description><![CDATA[The SQL Azure doesn't support sql jobs. So we cannot deploy the jobs on Azure. But we can schedule...]]></description>
      <content:encoded><![CDATA[<p>The SQL Azure doesn't support sql jobs. So we cannot deploy the jobs on Azure. But we can schedule the job (stored procedure execution) on Azure. There are 2 approaches to do this.</p>
<p><span style="font-size: large;"><strong>1. <span style="text-decoration: underline;">By scheduler available in Azure mobile service.</span></strong></span></p>
<p>We can execute sql procedures on Azure based on our need (schedule configuration).</p>
<ol>
<li>Create a mobile service.</li>
<li>Create&nbsp;a scheduler. Mention the database to be used for this.</li>
<li>Configure the scheduler for the frequency.</li>
<li>Click on tab Script. The script can be written in java script or .net. The script should have the code to run a proc.</li>
</ol>
<p>&nbsp;I used below code to run dbo.ExecuteDataRequest procedure Azure database.</p>
<p>&nbsp;function Execute_Process_Request() {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;console.log("Executing ExecuteDataRequest...");<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;mssql.query('Exec dbo.ExecuteDataRequest',{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;success: function(results){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;console.log("Finished the Process Request job.");<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;error: function(err) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;console.log("error is: " + err);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp;&nbsp; &nbsp;});<br />&nbsp;}</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/1882.blog.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/1882.blog.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/1882.blog.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/1882.blog.jpg" alt="" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/3681.blog1.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/3681.blog1.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/3681.blog1.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/3681.blog1.jpg" alt="" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/4606.blog2.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/4606.blog2.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/4606.blog2.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/4606.blog2.jpg" alt="" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/2437.blog3.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/2437.blog3.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/2437.blog3.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/2437.blog3.jpg" alt="" border="0" /></a></p>
<p>&nbsp;</p>
<p>Find the new user added which will run the scheduler (Under Login folder of Security of Azure db server). Need to grant execute permission to the new user on the database where we need to execute the job.</p>
<p>&nbsp;Grant Execute&nbsp;to [new user available under security of the database]</p>
<p>If you want to give permission only to execute few objects, we can do so by specifying the objects like Grant Execute on [object name]&nbsp;To [new user]&nbsp;</p>
<p><span style="font-size: large;"><strong>2. <span style="text-decoration: underline;">By creating an sql job on on-premise database server.</span></strong></span></p>
<p>We can create a normal sql job on any database server which resides on on-premise. We can execute the procedure with the help of sqlcmd utility.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/5037.blog4.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/5037.blog4.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/5037.blog4.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/5037.blog4.jpg" alt="" border="0" /></a></p>
<p>&nbsp;</p>
<p>We can execute the job at remote database server with above sqlcmd utility. If we are using windows identity we can create credential and proxy to execute the job at remote server without providing the user credential in command.</p>]]></content:encoded>
    </item>
    <item>
      <title>Data compare between tables in SQL Server</title>
      <link>https://docs.microsoft.com/archive/blogs/ms-tech_learning_with_prasant/data-compare-between-tables-in-sql-server</link>
      <pubDate>Fri, 06 Jun 2014 00:58:58 GMT</pubDate>
      <dc:creator><![CDATA[Prasant Nanda]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ms-tech_learning_with_prasant/2014/06/06/data-compare-between-tables-in-sql-server/</guid>
      <description><![CDATA[Problem

Now days we are dealing with lot of data every day. We process more and more data in our...]]></description>
      <content:encoded><![CDATA[<strong><span style="text-decoration: underline">Problem</span></strong>

Now days we are dealing with lot of data every day. We process more and more data in our application and it may be from upstream, same system, for downstream etc. Consider an upstream system from where we get 100,000 to 200,000 records every day and the data does not have any differentiator to the data definition i.e. we cannot find whether the data is modified / added (no timestamp column). If the upstream system uses a timestamp or exposes differential data, we are fine. But if the source doesn’t do that, we are end of consuming all data and do a merge with our destination. In this case also we need to process all the records from source. Is it really needed to process all the records from source (imagine out of the big numbers only 100s of records really need to be processed)? Can we find a delta data from source even the source doesn’t provide delta row info?

<span style="text-decoration: underline"><strong>Proposal</strong></span>

We can use the Encryption algorithm to compare data. As the encryption algorithm will return same value for the same input. If a table has 30 columns, we can replace a single column to replace all 30 columns. We can use HASHBYTES(‘algorithm’,&lt;input data&gt;) function. Its output is a varbinary format. The supported algorithms are mentioned below.

&lt;algorithm&gt;::= MD2 | MD4 | MD5 | SHA | SHA1 | SHA2_256 | SHA2_512

SHA1 algorithm is the ideal one, but may give repeated data after many years. If the application doesn’t need to store the hash data, we can manage with this algorithm otherwise we can rely on SH2-256 algorithm which will generate 256 bit output data.

<span style="text-decoration: underline"><strong>How it will help</strong></span>

We can use this algorithm to compare two datasets and find the delta data, so that we can process only the data which are modified.

SELECT

TAB1.COL1, TAB1.COL2

FROM (

SELECT

COL1, COL2, HASHBYTES(‘SHA1’,ISNULL(COL1,’NA’) + CAST(ISNULL(COL2,0) AS VARCHAR(10))) HSHKey

FROM  TAB) TAB1

LEFT OUTER JOIN (

SELECT

COL1, COL2, HASHBYTES(‘SHA1’,ISNULL(COL1,’NA’) + CAST(ISNULL(COL2,0) AS VARCHAR(10))) HSHKey

FROM  TAB_BAK) TAB2

ON
TAB1. HSHKey  = TAB2. HSHKey

WHERE
TAB2. HSHKey IS NULL

Not only this will help in finding delta data, it also helps in joining tables where we join more columns. All joining columns can be represented by a single hash key and can be joined.

Things to remember
<ol>
 	<li>The columns should not be NULL as the output is dependent on data. So the Null value should be handled with a default one.</li>
 	<li>Since the functions accepts 2 arguments, the second one we can add all the needed columns and convert the int, numeric / decimal values to char format.</li>
 	<li>We can use HASHBYTES(‘SHA1’,ISNULL(COL1,’NA’) +<strong><em>’|’</em></strong>+ CAST(ISNULL(COL2,0) AS VARCHAR(10))) to differentiate the output value of each row after adding all the columns. EX, R|Andy|Jo and Randy|J|O.</li>
 	<li>The output value depends on case sensitive of the data. Hash value for a is different from A.</li>
</ol>
Conclusion
<ol>
 	<li>This is a method of data comparison and we can create a computed column to store this varbinary data.</li>
 	<li>By creating an index on this column we can enhance the performance of data joining of tables with more column join. The data compare performance can be improved.</li>
 	<li>If there is any change to the data of any column the computed column also changes.</li>
 	<li>We can process only the delta data, which will help in performance of data processing.</li>
</ol>
For more info - <a href="https://technet.microsoft.com/en-us/library/ms174415.aspx">https://technet.microsoft.com/en-us/library/ms174415.aspx</a>

SHA1 info - <a href="https://en.wikipedia.org/wiki/SHA-1">https://en.wikipedia.org/wiki/SHA-1</a>]]></content:encoded>
    </item>
    <item>
      <title>First hands on using SQL Server 2014</title>
      <link>https://docs.microsoft.com/archive/blogs/ms-tech_learning_with_prasant/first-hands-on-using-sql-server-2014</link>
      <pubDate>Mon, 28 Apr 2014 06:05:00 GMT</pubDate>
      <dc:creator><![CDATA[Prasant Nanda]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ms-tech_learning_with_prasant/2014/04/28/first-hands-on-using-sql-server-2014/</guid>
      <description><![CDATA[SQL Server...]]></description>
      <content:encoded><![CDATA[<p><strong>SQL Server 2014</strong></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The new version of SQL server 2014 comes with various capabilities for OLTP and DW system along with enhancements previous version features.</p>
<p><strong>Performance improvements</strong></p>
<ul>
<li>New In-Memory (codenamed&nbsp; as Hekaton) OLTP built in to core SQL Server database allows to improve performance of database applications.</li>
<li>Enhanced In-Memory ColumnStore for Data&nbsp;Warehousing &ndash; now updatable with even faster query speeds and with greater data compression for more real-time analytics support.</li>
<li>New buffer pool extension support to non-volatile memory such as solid state drives (SSDs) &ndash; Increase performance by extending SQL Server in-memory buffer pool to SSDs for&nbsp;faster paging.</li>
<li>New Enhanced Query Processing &ndash; speeds all SQL&nbsp;Server queries regardless of workload.</li>
</ul>
<p><strong>Enhanced Availability, Security and Scalability</strong></p>
<ul>
<li>Enhanced AlwaysOn &ndash; Built upon the significant capabilities introduced with SQL Server 2012, delivers mission critical availability with up to 8 readable secondaries and no downtime during online indexing operations.</li>
<li>Online Indexing at partition level &ndash; this is a good thing as now index rebuilding can be done at a partition level.</li>
<li>Statistics at the partition level &ndash; this will be a huge improvement in performance.</li>
</ul>
<ul>
<li>Increased scale &ndash; Continue to benefit from scale for up to 640 logical processors and 4TB of memory in a physical environment and up to 64 virtual processors and 1TB of memory per VM.</li>
<li>Network Virtualization &ndash; Abstracts networking layer so that it you can easily migrate SQL Server from one datacenter to another.</li>
<li>Storage Virtualization with Storage Spaces &ndash; Create pools of storage and storage tiers allowing your hot data to access the premium storage and cold data to access standard storage improving resilience, performance and<br />predictability.</li>
<li>Enhanced Resource Governance &ndash; With Resource Governor, SQL Server today helps you with scalability and predictable performance, and in SQL Server 2014, new capabilities allow you to manage IO, in addition to compute and memory to<br />provide more predictable performance.</li>
</ul>
<ul>
<li>Enhanced Separation of Duties &ndash; Achieve&nbsp;greater compliance with new capabilities for creating role and sub-roles.&nbsp; For example, a database administrator can now manage the data without seeing sensitive data or personally identifiable information.</li>
</ul>
<p><strong>Platform for Hybrid Cloud</strong></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SQL Server 2014 creates a strong platform for hybrid cloud where cloud scale can be leveraged to extend the scalability and availability of on-premises database applications as well as reduce costs.</p>
<p><strong>Simplified Cloud Backup and Disaster Recovery</strong></p>
<ul>
<li>Backup to Azure Storage &ndash; reduce costs and&nbsp;achieve greater data protection by backing up your on-premises database to Azure Storage at an instance level. Optimize backup policy with intelligence built in to SQL Server that monitors and tracks backup usage patterns to provide optimal cloud backup. Backups can be automatic or manual, and in case of an on-premises failure, a backup can be restored to a Windows Azure Virtual Machine.</li>
</ul>
<ul>
<li>Datafile on azure storage - Databases can be easily detached and migrated or moved to different virtual machines (that is, portability). Standby SQL Server virtual machines can be easily used for fast disaster recovery.</li>
</ul>
<h2>Tables</h2>
<p>&nbsp;</p>
<p>CREATE TABLE [dbo].[orders_mem](</p>
<p>&nbsp;&nbsp;&nbsp; [O_OrderKey] [int] NOT NULL PRIMARY KEY NONCLUSTERED HASH WITH (BUCKET_COUNT=3000000),</p>
<p>&nbsp;&nbsp;&nbsp; [O_CustKey] [int] NULL,</p>
<p>&nbsp;&nbsp;&nbsp; [O_OrderStatus] [varchar](64) NULL,</p>
<p>&nbsp;&nbsp;&nbsp; [O_TotalPrice] [decimal](13, 2) NULL,</p>
<p>&nbsp;&nbsp;&nbsp; [O_OrderDate] [datetime] NOT NULL INDEX IX_OrderDate NONCLUSTERED,</p>
<p>&nbsp;&nbsp;&nbsp; [O_OrderPriority] [varchar](15) NULL,</p>
<p>&nbsp;&nbsp;&nbsp; [O_Clerk] [varchar](64) NULL,</p>
<p>&nbsp;&nbsp;&nbsp; [O_ShipPriority] [int] NULL,</p>
<p>&nbsp;&nbsp;&nbsp; [O_Comment] [varchar](80) NULL</p>
<p>) WITH (MEMORY_OPTIMIZED=ON, DURABILITY = SCHEMA_AND_DATA)</p>
<p>&nbsp;</p>
<ul>
<li>There are two types of disabilities (SCHEMA_AND_DATA and SCHEMA_ONLY) supported in Heckaton. The first one keeps schema and data even the sql server restarts, where as in second case the schema only is retained when sql server restarts.</li>
<li>The data are stored as file stream. The object can be found in file stream.</li>
<li>Here primary key cannot be created on Clustered index as the data is residing in memory where data is stored in hash table with linked list connecting to rows.</li>
<li>Every memory-optimized table must have at least one index, because it is the indexes that combine all the rows into a single table. We cannot create index which accepts NULL values.</li>
<li>If we want to create index on varchar column in the table, the column should have windows collation of _BIN2 type (ex COLLATE Latin1_General_100_BIN2).</li>
<li>Once the table is created in memory, we cannot alter it. We can drop and recreate with new structure.</li>
<li>The hash indexes works better for equal search and range index works better for queries searched in range value.</li>
<li>The indexes are not stored and they are recreated when the sql server starts. We cannot create column store index on Heckaton tables.</li>
<li>The sys.tables need to be quried to find Heckaton objects by using option is_memory_optimized = 1</li>
<li>These don&rsquo;t support (n)varchar (max), userdefined datatypes etc.</li>
<li>We cannot MERGE the target Heckaton tables. The Heckaton tables cannot be populated or joined with cross&nbsp;database tables. Below query will not work.</li>
</ul>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INSERT INTO dbo.Table1</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT * FROM<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DB2.dbo.Table2</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; We have to store the table to a temp table before loading to Heckaton table.</p>
<h2>Stored Procedures</h2>
<p>&nbsp;</p>
<p>CREATE PROCEDURE &lt;Proc name&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Param list&gt;</p>
<p>With</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; native_compilation</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ,schemabinding</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ,execute as owner</p>
<p>AS</p>
<p>BEGIN atomic with(transaction isolation level = snapshot, language = 'english')</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT&nbsp; &lt;Col name&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM&nbsp; &lt;table name &gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE &lt;Condition&gt;</p>
<p>END</p>
<p>&nbsp;</p>
<ul>
<li>The natively complied stored procedures. The stored procedure is compiled to machine code and stored as dll.</li>
<li>The native compilation hints that it should be compiled to native code.</li>
<li>Schema binding option restricts the drop of the Heckaton objects.</li>
<li>Execute as owner to be mentioned as native compiled object cannot resolve the user and permissions.</li>
<li>Language is provided to provide the format of the timestamp used internally to manage transaction.</li>
<li>The objects must be two part name i.e. schema name and table name.</li>
<li>The dmv dm_os_loaded_modules can be queried to find the memory optimized objects loaded. When the server restarts, while querying this dmv, we can get the list of tables but procedures will not be listed until they are recompiled (executed). This behavior is to speed up the database recovery.</li>
<li>Below features are not supported as of now.
<ul>
<li>Distinct</li>
<li>SET option like NOCOUNT</li>
<li>Creation of temp table (# or table variables as they are stored in tempdb)</li>
<li>Common Table Expression</li>
<li>Ranking functions</li>
<li>Subqueries, Exists</li>
<li>Combining result sets by UNION (ALL)</li>
<li>The GROUP BY should have the aggregated function used as part of SELECT statement.</li>
</ul>
</li>
</ul>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT name</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM dbo.Table1</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GROUP BY name</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The above will work but not inside the proc. We need to add aggregate function in SELECT statement in order to work inside the proc.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT name, COUNT(id)</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM dbo.Table1</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GROUP BY name</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>References</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdn.microsoft.com/en-us/library/bb500435(v=sql.120).aspx">https://msdn.microsoft.com/en-us/library/bb500435(v=sql.120).aspx</a></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdn.microsoft.com/en-us/library/dn606154(v=sql.120).aspx">https://msdn.microsoft.com/en-us/library/dn606154(v=sql.120).aspx</a></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://blogs.technet.com/b/dataplatforminsider/archive/2014/03/18/sql-server-2014-releases-april-1.aspx">https://blogs.technet.com/b/dataplatforminsider/archive/2014/03/18/sql-server-2014-releases-april-1.aspx</a></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://www.brentozar.com/archive/2013/06/new-dmvs-in-sql-server-2014-ctp1/">https://www.brentozar.com/archive/2013/06/new-dmvs-in-sql-server-2014-ctp1/</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Azure Database Deployment</title>
      <link>https://docs.microsoft.com/archive/blogs/ms-tech_learning_with_prasant/sql-azure-database-deployment</link>
      <pubDate>Mon, 20 Jan 2014 04:12:00 GMT</pubDate>
      <dc:creator><![CDATA[Prasant Nanda]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ms-tech_learning_with_prasant/2014/01/20/sql-azure-database-deployment/</guid>
      <description><![CDATA[SQL Azure Database Updates and...]]></description>
      <content:encoded><![CDATA[<p><span style="text-decoration: underline;"><span style="font-size: medium;">SQL Azure Database Updates and Deployment</span></span></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Before going for the deployment plan, we assume the database is created in SQL Azure database server. &nbsp;In case of hybrid model where we have both on-premise and azure databases, we can create a data-sync agent and group to sync the databases. The syncAgent need to be created to define the on-premise database where as the sync group will define the Azure database details (the tables and columns to be synced, the frequency, whether source or target updates be considered as final&nbsp;etc).</p>
<p>A table must have clustered index to store data in Azure, but to sync data the table must have Primary key column defined. If a table is having a clustered index while creating and later Primary key is defined on same clustered key column, a unique, non clustered index will be created.</p>
<p>Please install the below executables for SQL Server 2012 in order to do setup for data-sync agent.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SharedManagementObjects, SQLSysClrTypes - x86 and SQLDataSyncAgent-Preview-ENU.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; <span style="text-decoration: underline;">Data-Sync installation Links</span></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdn.microsoft.com/en-us/library/jj823137.aspx">https://msdn.microsoft.com/en-us/library/jj823137.aspx</a></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdn.microsoft.com/en-us/library/windowsazure/jj823138.aspx">https://msdn.microsoft.com/en-us/library/windowsazure/jj823138.aspx</a>&nbsp;(Select Install Instruction collapsible button and choose X86 options for the miss)</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; The sync agent can be scheduled to do updates based on desired interval.</p>
<p>We can run SSIS package in on-premise database server to do data sync with azure database. Based on the number and size of tables we can decide whether to go for data sync or run SSIS package (any other Azure supported ETL tool can also be considered). Since it depends on the data transfer over network (separate charge for data transfer on azure), we need to plan accordingly.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; When we need to delete the sync agent, it will not allow us to do that i.e. an exception will be raised as the agent is referenced with other object. In order to delete the agent, we need to stop the on-premise database service and&nbsp;unregister the key reference in data sync tool and delete the agent in Azure portal.</p>
<p><span style="text-decoration: underline;"><span style="font-size: medium;">Database deployment</span></span></p>
<p>The scripts can be deployed to Azure by the help of data tier application file (.dacpac). There are various ways to create .dacpac files. Refer the link <a href="https://pietervanhove.azurewebsites.net/?p=1011">https://pietervanhove.azurewebsites.net/?p=1011</a>&nbsp;to create file.</p>
<p>Here we will discuss the deployment in two ways.</p>
<p><span style="text-decoration: underline;">Through SSMS</span></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Open the SSMS and right click on the database which needs to be deployed to azure. Select appropriate menu options from tasks. The Export option will generate the schema along with data of the tables. The Extract option will generate the schema only. The Deploy option will do the deployment on Azure.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/0358.DBDeploy.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/0358.DBDeploy.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/0358.DBDeploy.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/0358.DBDeploy.jpg" alt="" border="0" /></a></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Select appropriate files and do the deployment.</p>
<p>&nbsp;&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/6237.DBDeploy11.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/6237.DBDeploy11.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/6237.DBDeploy11.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/6237.DBDeploy11.jpg" alt="" border="0" /></a></p>
<p>In Azure portal also we can generate the scripts for deployment. It will prompt for the location to save the dacpac file when user selects the Extract option. The user can slect the on-premise dacpac file to do deployment by selecting Deploy option.</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/8372.Azure%20DB%20Deployment.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/8372.Azure-DB-Deployment.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/8372.Azure%20DB%20Deployment.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/8372.Azure-DB-Deployment.jpg" alt="" border="0" /></a></p>
<p><span style="font-size: small; text-decoration: underline;">By the command prompt window</span></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; We can use the SQLPackage (<a href="https://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx">https://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx</a>) to do the deployment.</p>
<p>Export from the source database - bacpac file creation (to Export schema and data) - The operation will fail if any table exists without Clustered index.</p>
<p>C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin&gt;SqlPackage.exe /a:Export /ssn:prasantnanda-2k&nbsp; /sdn:MyTestDB /tf:c:/prasant/MyTestDBBP.bacpac</p>
<p>Import on target server (Azure)</p>
<p>C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin&gt;SqlPackage.exe /a:Import /SourceFile:c:/prasant/MyTestDBBP.bacpac /tsn:ihq656uayo.database.windows.net,1433&nbsp;</p>
<p>/tdn:SampleSchoo /tu:prasant.nanda /tp:msxxxxxx45</p>
<p>&nbsp;In this way we can migrate a brand new database on Azure.</p>
<p>dacpac file creation (to Extract schema)</p>
<p>C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin&gt;SqlPackage.exe /a:Extract /ssn:prasantnanda-2k&nbsp; /sdn:MyTestDB /tf:c:/prasant/MyTestDBDP.dacpac</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/4024.Extract.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/4024.Extract.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/4024.Extract.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/4024.Extract.jpg" alt="" border="0" /></a></p>
<p>dacpac deployment (to Publish diff schema)</p>
<p>C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin&gt;SqlPackage.exe /a:Publish /SourceFile:c:/prasant/MyTestDBBP.dacpac /tsn:ihq656uayo.database.windows.net,1433&nbsp;</p>
<p>/tdn:SampleSchoo /tu:prasant.nanda /tp:msxxxxxx45 /p:AllowIncompatiblePlatform=TRUE</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/4572.Publish.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/4572.Publish.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/4572.Publish.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/4572.Publish.jpg" alt="" border="0" /></a></p>
<p>If we don't provide parameter /p:AllowIncompatiblePlatform=TRUE, it will throw error for&nbsp;platform incompatibility. The target platform as Azure can be provided while creating dacpac (option is available in SSDT i.e. project target platform).</p>
<p>We will be notified with errors while&nbsp;deploying a dacpac if there are any scripts available with&nbsp;SQL Azure&nbsp;unsupported features.</p>
<p>If there is a column dropped in the schema, while deploying it will throw error as it suspects some data loss.</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/3566.DropColumn_Err.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/3566.DropColumn_5F00_Err.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/3566.DropColumn_Err.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/3566.DropColumn_5F00_Err.jpg" alt="" border="0" /></a></p>
<p>In order to go ahead with column dropped as schema change we need to provide the parameter /p:BlockOnPossibleDataLoss=False</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/2654.DropColumn_Success.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/2654.DropColumn_5F00_Success.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/2654.DropColumn_Success.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/2654.DropColumn_5F00_Success.jpg" alt="" border="0" /></a></p>
<p>If there is an object got deleted from in the source database, the same will not be deleted even after deployment. If we need to delete that we have to use the parameter /p:DropObjectsNotInSource=True.</p>
<p>There are many parameters available in SQLPackage (<a href="https://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx">https://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx</a>&nbsp;)documentation. Please use appropriate parameters for the required action.</p>
<p>The advantage of using the command line way of deployment is, we can create a batch file (to extract and publish database changes) and schedule the batch file run for deployment.</p>
<p>Links for&nbsp;automated database deployment.</p>
<p><a href="https://support.ready-roll.com/customer/portal/articles/759692-setting-up-automated-sql-server-database-deployment">https://support.ready-roll.com/customer/portal/articles/759692-setting-up-automated-sql-server-database-deployment</a><br /><a href="https://www.anujchaudhary.com/2012/08/sqlpackageexe-automating-ssdt-deployment.html">https://www.anujchaudhary.com/2012/08/sqlpackageexe-automating-ssdt-deployment.html</a></p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Azure Migration</title>
      <link>https://docs.microsoft.com/archive/blogs/ms-tech_learning_with_prasant/sql-azure-migration</link>
      <pubDate>Fri, 27 Dec 2013 20:06:00 GMT</pubDate>
      <dc:creator><![CDATA[Prasant Nanda]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ms-tech_learning_with_prasant/2013/12/27/sql-azure-migration/</guid>
      <description><![CDATA[Since SQL Azure doesn&rsquo;t support the database restore option, we have to create each db objects...]]></description>
      <content:encoded><![CDATA[<p>Since SQL Azure doesn&rsquo;t support the database restore option, we have to create each db objects and execute them in Azure. So we have created our empty database in Azure and below steps to be performed for database objects.</p>
<p>&nbsp;<span style="font-family: arial,helvetica,sans-serif; font-size: medium;">User Login creation</span> &ndash; We have to generate scripts for the required logins from on-premise database server. Each login should be associated with a password as there is no windows login available.</p>
<p>&nbsp;--===============================================</p>
<p>-- Create SQL Login template for SQLAzure Database</p>
<p>--===============================================</p>
<p>&nbsp;CREATE LOGIN [myLogin]</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WITH PASSWORD = 'test001chk@sys_12345'</p>
<p>GO&nbsp;</p>
<p>The password must be minimum 8 characters and should be complex i.e. mix of numeric, special character etc. Below is the script of login create generated in Azure</p>
<p>&nbsp;USE [master]</p>
<p>GO</p>
<p>&nbsp;/* For security reasons the login is created disabled and with a random password. */</p>
<p>/****** Object:&nbsp; Login [myLogin]&nbsp;&nbsp;&nbsp;Script Date: 13-12-2013 08:47:44 ******/</p>
<p>CREATE LOGIN [myLogin] WITH PASSWORD=N'&agrave;&para;''&deg;&divide;&frac12;&Ucirc;&frac34;&euml;2&sect;&Yacute;e &sup2;&euml;&aring;''&ucirc;}&Egrave;&aelig;&iquest;Lh`', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF</p>
<p>GO&nbsp;</p>
<p>ALTER LOGIN [myLogin] DISABLE</p>
<p>GO</p>
<p><span style="font-family: arial,helvetica,sans-serif; font-size: medium;">DB Object creation</span> &ndash; We have to generate scripts in SSMS and that should be executed in Azure db.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/3175.dbScriptGeneration.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/3175.dbScriptGeneration.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/3175.dbScriptGeneration.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/3175.dbScriptGeneration.jpg" alt="" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/2313.dbScriptGeneration_1.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/2313.dbScriptGeneration_5F00_1.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/2313.dbScriptGeneration_1.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/2313.dbScriptGeneration_5F00_1.jpg" alt="" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/4426.dbScriptGeneration_2.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/4426.dbScriptGeneration_5F00_2.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/4426.dbScriptGeneration_2.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/4426.dbScriptGeneration_5F00_2.jpg" alt="" border="0" /></a></p>
<p><span style="font-size: small;">Tables</span> &ndash; <span style="font-size: small;">we need to analyze the script as there some features not supported by Azure</span>.</p>
<p><span style="font-size: small;">Data Compression is not allowed &ndash; If we have specified data compression, we have to remove option.</span></p>
<p>DATA_COMPRESSION = PAGE is not supported in current version of SQL Azure</p>
<p><span style="font-size: small;">Creating object on Filegroup option &ndash; We cannot create a table with index on a specified filegroup. We can specify filegroup for table, but not for index</span></p>
<p>SET ANSI_NULLS ON</p>
<p>GO</p>
<p>SET QUOTED_IDENTIFIER ON</p>
<p>GO</p>
<p>SET ANSI_PADDING ON</p>
<p>GO</p>
<p>CREATE TABLE [dbo].[Customers](</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [CustomerId] [int] IDENTITY(1,1) NOT NULL,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [CustomerName] [varchar](100) NULL,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [CustomerBusiness] [varchar](200) NULL,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [CustomerMSToolsUsage] [varchar](300) NULL,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [AdditionalInfo] [varchar](300) NULL,</p>
<p>&nbsp;CONSTRAINT [PK_Customers] PRIMARY KEY CLUSTERED</p>
<p>(&nbsp; [CustomerId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) -- <strong><span style="text-decoration: underline;">ON [PRIMARY] is not allowed</span></strong></p>
<p>) ON [PRIMARY]</p>
<p>GO</p>
<p>SET ANSI_PADDING OFF</p>
<p>GO</p>
<p><span style="font-size: small;">Filegroup reference and partitioning scheme&nbsp; error occurs when we mention the filegroup for index.</span></p>
<p><span style="font-size: small;">Each table should have clustered index. If it is not available, we have to add it before inserting data into table.</span></p>
<p><span style="font-size: small;">StoredProcedure,function, views- The current version of Azure doesn&rsquo;t support cross database reference.</span></p>
<ol>
<li><span style="font-size: small;">If there is a table hint provided in the query the WITH keyword is mandatory.&nbsp; Deprecated feature 'Table hint without WITH' is not supported in this version of SQL Server.</span></li>
<li><span style="font-size: small;">SYSTEM_USER, DBCC CHECKIDENT, SELECT INTO, SUSER_NAME, NEWSEQUENTIALID are not supported. We canot create object with these.</span></li>
</ol>
<p>&nbsp;<span style="font-size: small;">In above mentioned approach, we have to analyze each script manually and modify wherever needed. There is another way of generating the script by using a migration tool wizard.</span></p>
<p>&nbsp;</p>
<p><span style="font-size: small;">We can use AzureMigrationWizard (codeplex) to automatically generate the scripts automatically with the appropriate syntax for Azure.</span></p>
<p>&nbsp;<strong>AzureMigrationWizard </strong><span style="font-size: small;">can be downloaded at&nbsp;</span><a href="https://sqlazuremw.codeplex.com/">https://sqlazuremw.codeplex.com/</a><strong></strong></p>
<p>Once downloaded the binaries, open the &ldquo;Dependencies&rdquo; config file of the tool. Please use the version 11 for sql server 2012.</p>
<p>&nbsp;<strong>&nbsp;<br />&lt;Dependency&gt;</strong><strong>&nbsp;&nbsp;<br />&lt;Assembly&gt;Microsoft.SqlServer.Smo, Version=11.0.0.0,<br />Culture=neutral, PublicKeyToken=89845dcd8080cc91&lt;/Assembly&gt;</strong><strong><br />&lt;Type&gt;Microsoft.SqlServer.Management.Smo.Server&lt;/Type&gt;</strong><strong><br />&lt;/Dependency&gt;</strong></p>
<p><strong>Double click on SQLAzureMW application file.</strong><strong>&nbsp;&nbsp;</strong></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/2275.Mig1.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/2275.Mig1.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/2275.Mig1.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/2275.Mig1.jpg" alt="" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/4442.Mig2.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/4442.Mig2.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/4442.Mig2.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/4442.Mig2.jpg" alt="" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/6560.Mig3.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/6560.Mig3.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/6560.Mig3.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/6560.Mig3.jpg" alt="" border="0" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/8156.Mig4.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/8156.Mig4.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/8156.Mig4.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/8156.Mig4.jpg" alt="" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/6378.Mig5.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/6378.Mig5.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/6378.Mig5.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/6378.Mig5.jpg" alt="" border="0" /></a></p>
<p>Below are the changes done in the script by the tool.</p>
<p>DATA_COMPRESSION = PAGE is not supported in current version of SQL Azure</p>
<p>Deprecated feature 'Table hint without WITH'.&nbsp; Automatically added WITH for you.</p>
<p>Adding clustered index ci_azure_fixup_dbo_Exxxxg on [dbo].[Exxxxg].&nbsp; You may want to change this index.&nbsp;</p>
<p>Save the script generated by the tool which can be referred later.</p>
<p>We can also use the Deploy database to Azure option in SSMS. Please refer <a href="https://blogs.msdn.com/b/brunoterkaly/archive/2013/09/26/migrating-an-on-premises-sql-server-2012-database-to-windows-azure-sql-database.aspx">https://blogs.msdn.com/b/brunoterkaly/archive/2013/09/26/migrating-an-on-premises-sql-server-2012-database-to-windows-azure-sql-database.aspx</a> for details.</p>]]></content:encoded>
    </item>
    <item>
      <title>What is SQL Azure</title>
      <link>https://docs.microsoft.com/archive/blogs/ms-tech_learning_with_prasant/what-is-sql-azure</link>
      <pubDate>Tue, 17 Dec 2013 20:29:00 GMT</pubDate>
      <dc:creator><![CDATA[Prasant Nanda]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ms-tech_learning_with_prasant/2013/12/17/what-is-sql-azure/</guid>
      <description><![CDATA[SQL Azure

A cloud based SQL Server database on clustered servers.
Servers are load balanced,...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: book antiqua,palatino; font-size: x-large;">SQL Azure</span></p>
<ol>
<li><span style="font-family: book antiqua,palatino; font-size: large;">A cloud based SQL Server database on clustered servers.</span></li>
<li><span style="font-family: book antiqua,palatino; font-size: large;">Servers are load balanced, replicated databases and failure detection. Which provides high availability, scalability and reliability.</span></li>
<li><span style="font-family: book antiqua,palatino; font-size: large;">Each user database is having 3 replicated </span><span style="font-family: book antiqua,palatino; font-size: large;">databases. Before a transaction gets committed, one primary and one secondary </span><span style="font-family: book antiqua,palatino; font-size: large;">replicated database should also be updated.</span></li>
<li><span style="font-family: book antiqua,palatino; font-size: large;">It supports .net framework 3.5 onwards and OData </span><span style="font-family: book antiqua,palatino; font-size: large;">(a WCF data service) interface to transfer data. OLEDB is not supported.</span></li>
<li><span style="font-family: book antiqua,palatino; font-size: large;">Storage account ConnectionStringBuilder for </span><span style="font-family: book antiqua,palatino; font-size: large;">cloud configuration can be used to create a connection string.</span></li>
<li><span style="font-family: book antiqua,palatino; font-size: large;">Federations &ndash; It is the way to achieve high </span><span style="font-family: book antiqua,palatino; font-size: large;">scalability and performance through horizontal partitioning (row split) of one </span><span style="font-family: book antiqua,palatino; font-size: large;">or more tables data. It is a database object in database and there can be </span><span style="font-family: book antiqua,palatino; font-size: large;">multiple federations in a database. Each federation has a single key for </span><span style="font-family: book antiqua,palatino; font-size: large;">partitioning data. The database contains the federation database object is </span><span style="font-family: book antiqua,palatino; font-size: large;">known as federation root. Applications connect to federation root.</span></li>
</ol>
<p>&nbsp;<span style="font-family: book antiqua,palatino; font-size: large;">Set Up</span></p>
<ol>
<li><span style="font-family: book antiqua,palatino; font-size: large;">Get a windows Azure subscription. Get the SQL </span><span style="font-family: book antiqua,palatino; font-size: large;">Server service.</span></li>
<li><span style="font-family: book antiqua,palatino; font-size: large;">We can create database either accessing the </span><span style="font-family: book antiqua,palatino; font-size: large;">Azure database server on SSMS or Azure service portal.</span></li>
<li><span style="font-family: book antiqua,palatino; font-size: large;">There are 2 version of sql azure subscriptions </span><span style="font-family: book antiqua,palatino; font-size: large;">web and business editions. In web edition a user can create 1 master and 149 </span><span style="font-family: book antiqua,palatino; font-size: large;">user databases.</span></li>
<li><span style="font-family: book antiqua,palatino; font-size: large;">Only SQL Server login is allowed. The ip address </span><span style="font-family: book antiqua,palatino; font-size: large;">from which the database to be accessed should be configured in firewall. The </span><span style="font-family: book antiqua,palatino; font-size: large;">user can configure the range of ip addresses. The connections are encrypted and</span><br /><span style="font-family: book antiqua,palatino; font-size: large;">managed by firewall rules.</span></li>
<li><span style="font-family: book antiqua,palatino; font-size: large;">REST based APIs are used to manage database. </span><span style="font-family: book antiqua,palatino; font-size: large;">These include create, drop database servers and manage firewall rules.</span></li>
</ol>
<p><br /> <br /> <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/2251.dbcreate.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/2251.dbcreate.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/2251.dbcreate.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/2251.dbcreate.jpg" alt="" width="647" height="342" border="0" /></a><br />&nbsp;&nbsp;<br />&nbsp;&nbsp;<br /><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp;&nbsp;&nbsp;If&nbsp;user selects Custom Create option of database create, user has to provide an existing or new&nbsp;server name (user can select the preferred location of the server).&nbsp;</span><br />&nbsp;&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/2063.dbcreate_1.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/2063.dbcreate_5F00_1.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/2063.dbcreate_1.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/2063.dbcreate_5F00_1.jpg" alt="" width="507" height="402" border="0" /></a><br />&nbsp;&nbsp;</p>
<p><span style="font-family: book antiqua,palatino; font-size: large;">Once server is created, we can configure the firewall setting for server access. The ip of the local system (info can be get from ipconfig) may be different from the global ip</span> <span style="font-size: large;">(<a href="https://www.whatismyip.com/">https://www.whatismyip.com/</a>).</span></p>
<p><br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/6177.dbcreate_Firewall.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/6177.dbcreate_5F00_Firewall.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/6177.dbcreate_Firewall.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/6177.dbcreate_5F00_Firewall.jpg" alt="" border="0" /></a></p>
<p><br /><span style="font-family: book antiqua,palatino; font-size: large;">Once setting are completed, user can access the database. The user has to append the server name while accessing the desired database.</span></p>
<p><span style="font-family: book antiqua,palatino; font-size: large;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/1614.dbcreate_Credential.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/1614.dbcreate_5F00_Credential.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/83/1614.dbcreate_Credential.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-62-83/1614.dbcreate_5F00_Credential.jpg" alt="" border="0" /></a></span></p>
<p><span style="font-family: book antiqua,palatino; font-size: large;">The user can also login to the azure database from SSMS (SQL Server 2008 R2 onwards). While accessing from SSMS, the user needs to provide the SQL authentication and credential like above picture.</span></p>
<p><span style="font-family: book antiqua,palatino; font-size: large;">How SQL Azure is different from traditional SQL world?</span></p>
<p>&nbsp;</p>
<table style="width: 99%;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="50%">
<p align="center"><span style="font-family: book antiqua,palatino; font-size: large;">Traditional SQL Server</span></p>
</td>
<td valign="top" width="50%">
<p align="center"><span style="font-family: book antiqua,palatino; font-size: large;">SQL Azure</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">1. Supports all system databases.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">1. Only Master and some tempdb functionality supported.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">2. Supports very large size databases.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">2. Based on edition (web and business) the max size per database is 5</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; and 50 GB respectively.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">3. Both windows and Sql Server authentications are allowed.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">3. Only Sql Server authentication allowed. Login names like sa,</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; administrator are not available.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">4. SQL server server roles are available.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">4. Database roles dbManager and loginmanager are available.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">5. No need to add server name while login.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">5.&nbsp; The user name should be</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; appended with @Server name while login. The password should be minimum 8</span><br /><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; character length and strong i.e. numeric and special characters must.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">6. Collation can be set per database.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">6. Collation cannot be set per database and can set on columns and</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; expressions.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">7. Supports full functionality of database objects.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">7. Does not support all functionalities. Index properties cannot be</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; changed and cannot be created on specified filegroup. DDL triggers are not</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; supported.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">8. We can refer cross databases.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">8. Other database reference is not allowed.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">9. Data compression is allowed.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">9. Data compression is not allowed.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">10. Indexes on table are not mandatory.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">10. Clustered index is compulsory. Even we create primary key on</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; nonclustered index of a table, clustered index in mandatory. Temp table</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; (#temp) can be created on heap.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">11. Service broker, Encryption, SQL Agent, Linked Servers are</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; allowed.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">11. Service broker, Encryption, SQL Agent, Linked Servers, full text</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; search and xml indexes are not allowed.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">12. Backup, restore, Replication, Mirroring, Log shipping are</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; supported.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">12. Backup, restore, Replication, Mirroring, Log shipping are not</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; supported. Index re-org is not allowed.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">13. SQL Profiler is available.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">13. SQL Profiler is not available.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">14. FileStream, Distributed transaction, Global temp table Resource</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; governor are supported.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">14. FileStream, Distributed transaction, Global temp table, Resource governor,</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; Linked server are not supported. Data and log file access&nbsp; is not there.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">15. SSIS is available.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">15. SSIS tool is not available. We can use SQL Azure database as</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; destination in on-premise SSIS packages.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">16. SELECT INTO syntax of data load supported.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">16. SELECT INTO syntax of data load not supported.</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">17. Query Hints are supported.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">17. Query Hints should be used with key word WITH. It supports Query,</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; Table and Join hints. PAGELOCK is not supported and it doesn&rsquo;t support query</span><span style="font-family: book antiqua,palatino; font-size: large;">&nbsp; parallelism (MAXDOP).</span></p>
</td>
</tr>
<tr>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">18. Read committed Isolation is the default one.</span></p>
</td>
<td valign="top" width="50%">
<p><span style="font-family: book antiqua,palatino; font-size: large;">18. Read committed snapshot isolation is the default one.</span></p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
  </channel>
</rss>