<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Mssql on Duke Hsu ｜ Learn • Build • Share</title><link>https://www.dukehsu.com/tags/mssql.html</link><description>Recent content in Mssql on Duke Hsu ｜ Learn • Build • Share</description><image><title>Duke Hsu ｜ Learn • Build • Share</title><url>https://www.dukehsu.com/images/og-default.jpg</url><link>https://www.dukehsu.com/images/og-default.jpg</link></image><generator>Hugo</generator><language>en-US</language><lastBuildDate>Thu, 19 Mar 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.dukehsu.com/tags/mssql/index.xml" rel="self" type="application/rss+xml"/><item><title>將docker 中的SQL database 遷移到ms Azure</title><link>https://www.dukehsu.com/posts/docker-sql-to-azure.html</link><pubDate>Thu, 19 Mar 2026 00:00:00 +0000</pubDate><guid>https://www.dukehsu.com/posts/docker-sql-to-azure.html</guid><description>&lt;h2 id="scenario"&gt;Scenario&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Source Database running on Docker (Linux Server)&lt;/li&gt;
&lt;li&gt;Traget Database running on Azure Server&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="prerequisites"&gt;Prerequisites&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;源database 的結構和目標database 的結構、表、限制等都相同&lt;/li&gt;
&lt;li&gt;對源database 和目標database 具有訪問權限&lt;/li&gt;
&lt;li&gt;SQL Server Management Studio&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="step-by-step"&gt;Step by Step&lt;/h2&gt;
&lt;h3 id="on-source-database"&gt;On Source Database&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Generate Scripts&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img alt="Pasted image 20260319141730" loading="lazy" src="https://www.dukehsu.com/posts/docker-sql-to-azure/images/Pasted-image-20260319141730.webp"&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Select specific database objects&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img alt="Pasted image 20260319142035" loading="lazy" src="https://www.dukehsu.com/posts/docker-sql-to-azure/images/Pasted-image-20260319142035.webp"&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Scripting Options&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img alt="Pasted image 20260319142309" loading="lazy" src="https://www.dukehsu.com/posts/docker-sql-to-azure/images/Pasted-image-20260319142309.webp"&gt;&lt;/p&gt;
&lt;p&gt;Note: 根據需求調整Scripting Options！！！！&lt;/p&gt;
&lt;p&gt;目前場景需求的option 是這樣設置的&lt;/p&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Types of data to script：选择 Data only（因为结构已经存在）&lt;/li&gt;
&lt;li&gt;Script DROP statements：设置为 False&lt;/li&gt;
&lt;li&gt;Script Indexes：设置为 False&lt;/li&gt;
&lt;li&gt;Script Primary Keys：设置为 False&lt;/li&gt;
&lt;li&gt;Script Foreign Keys：设置为 False&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Save as Script file&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img alt="Pasted image 20260319142556" loading="lazy" src="https://www.dukehsu.com/posts/docker-sql-to-azure/images/Pasted-image-20260319142556.webp"&gt;&lt;/p&gt;</description></item><item><title>Using Python and Streamlit with MS SQL</title><link>https://www.dukehsu.com/posts/using-python-and-streamlit-with-mssql.html</link><pubDate>Sat, 22 Nov 2025 00:00:00 +0000</pubDate><guid>https://www.dukehsu.com/posts/using-python-and-streamlit-with-mssql.html</guid><description>&lt;h2 id="table-of-contents"&gt;Table of Contents&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create and activate the Python environment&lt;/li&gt;
&lt;li&gt;Install Python modules&lt;/li&gt;
&lt;li&gt;Install MS SQL&lt;/li&gt;
&lt;li&gt;Start coding &amp;amp; Run&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h2 id="prerequisites"&gt;Prerequisites&lt;/h2&gt;
&lt;p&gt;For this project, we used MS SQL, so the operating system is Windows Server 2012. I installed MS SQL Server 2012 Advanced. If your system is Windows 10 or Windows 11, install the latest version of MS SQL Express instead.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Python 3.12&lt;/li&gt;
&lt;li&gt;Windows OS&lt;/li&gt;
&lt;li&gt;MS SQL Express&lt;/li&gt;
&lt;li&gt;Internet&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h2 id="get-started"&gt;Get started&lt;/h2&gt;
&lt;h3 id="create-and-activate-the-python-environment"&gt;Create and activate the Python environment&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;# Create the virtual environment&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;python&lt;/span&gt; &lt;span class="n"&gt;-m&lt;/span&gt; &lt;span class="n"&gt;venv&lt;/span&gt; &lt;span class="n"&gt;c:&lt;/span&gt;&lt;span class="p"&gt;\&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="p"&gt;\&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;# Activate it&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;&lt;span class="n"&gt;c:&lt;/span&gt;&lt;span class="p"&gt;\&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="p"&gt;\&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;\&lt;/span&gt;&lt;span class="n"&gt;Scripts&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;.\&lt;/span&gt;&lt;span class="n"&gt;activate&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;# Deactivate it when finished&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;deactivate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="install-python-modules"&gt;Install Python modules&lt;/h3&gt;
&lt;p&gt;You can install these modules step by step, or use &lt;code&gt;pip install -r requirement.txt&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>