Files
doc-exports/docs/dws/tool/DWS_DS_028.html
luhuayi a5e3903f6b DWS TG 910.211 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: luhuayi <luhuayi@huawei.com>
Co-committed-by: luhuayi <luhuayi@huawei.com>
2025-04-23 13:53:01 +00:00

39 lines
9.6 KiB
HTML

<a name="EN-US_TOPIC_0000001860198725"></a><a name="EN-US_TOPIC_0000001860198725"></a>
<h1 class="topictitle1">Opening and Saving SQL Scripts</h1>
<div id="body1584526252529"><div class="section" id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_section171361011182215"><h4 class="sectiontitle">Opening an SQL Script</h4><p id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_p3942429">Follow the steps to open an SQL script:</p>
<ol id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_ol35481869"><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li1814025993618"><span>Choose <strong id="EN-US_TOPIC_0000001860198725__b1611993519258">File</strong> &gt; <strong id="EN-US_TOPIC_0000001860198725__b945583702511">Open</strong> from the main menu. Alternatively, click <strong id="EN-US_TOPIC_0000001860198725__b1016915262614">Open</strong> on the toolbar or right-click the <strong id="EN-US_TOPIC_0000001860198725__b1523214952613">SQL Terminal</strong> and select <strong id="EN-US_TOPIC_0000001860198725__b99511311182612">Open</strong>.</span><p><p id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_p17382100173719">If the SQL Terminal has existing content, then there will be an option to overwrite the existing content or append content to it.</p>
</p></li><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li32875415369"><span>The Open dialog box is displayed.</span></li><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li2417790911166"><span>In <strong id="EN-US_TOPIC_0000001860198725__b15952183542818">Open</strong> dialog box, select the SQL file to import and click <strong id="EN-US_TOPIC_0000001860198725__b799524116282">Open</strong>.</span><p><p id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_p89511710163619">The selected SQL script is opened as a <strong id="EN-US_TOPIC_0000001860198725__b1383995922810">File Terminal</strong>.</p>
<p id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_p110110490293">The icons on the file terminal tab are different from those on the <strong id="EN-US_TOPIC_0000001860198725__b17273457553">SQL terminal</strong> tab. When you move the mouse cursor over the source file, corresponding database connection will be displayed on <strong id="EN-US_TOPIC_0000001860198725__b193351951182913">File Terminal</strong>.</p>
</p></li></ol>
<div class="note" id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_note127611408320"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_ul95902419599"><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li1959015419591">The encoding type of the SQL file must match the encoding type specified in <a href="DWS_DS_005.html#EN-US_TOPIC_0000001813438860__table1510418570339">Table 1</a>.</li><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li85907410591">Label of the file terminal will start with asterisk(*) if any of its content is edited. Dirty flag is removed once the file terminal is saved.</li><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li76788246339">File Terminals cannot be renamed. One terminal is always mapped to one Source Script File, but one script can be opened in multiple terminals.</li><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li9130123418261">You can open SQL scripts only on SQL Terminals.</li></ul>
</div></div>
</div>
<p id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_p179381431153513">Data Studio allows you to save and open SQL scripts in the SQL Terminal. After saving the changes, SQL Terminal will be changed to a File Terminal.</p>
<div class="section" id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_section6440164084417"><h4 class="sectiontitle">Saving an SQL Script</h4><p id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_p17509173264212">The <strong id="EN-US_TOPIC_0000001860198725__b2221216173217">Save</strong> option saves the File Terminal content to the associated file.</p>
<p id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_p46107371">Follow the steps to save an SQL script:</p>
<ol id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_ol12313157"><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li168515402033"><span>Perform any of the following operations:</span><p><ul id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_ul1516835410916"><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li161681154393">Choose File &gt; Save from the main menu.</li><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li4168854099">Press "Ctrl + S" to save the SQL terminal content. (This operation can be performed to save the file terminal content.)</li><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li41699541197">Click <strong id="EN-US_TOPIC_0000001860198725__b10844323113311">Save</strong> on the toolbar or right-click the SQL Terminal and select <strong id="EN-US_TOPIC_0000001860198725__b1493392753312">Save</strong>.</li></ul>
<p id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_p611811521236">The <strong id="EN-US_TOPIC_0000001860198725__b742101317339">Data Studio Security Disclaimer</strong> dialog box is displayed.</p>
</p></li><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li15691113193117"><span>Click <strong id="EN-US_TOPIC_0000001860198725__b59111824163411">OK</strong>.</span><p><div class="p" id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_p6474161684819">Data Studio displays the status of the operation in the status bar.<div class="note" id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_note1550514155483"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_ul550571515481"><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li175058158487">The script is saved as an SQL file. Data Studio sets the read/write permission for the saved SQL file. To ensure security, you must set the read/write permissions for folders.</li><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li1950581511481">When a change is made in a file and if that associated file is unavailable, it will trigger the <strong id="EN-US_TOPIC_0000001860198725__b637312134357">Save As</strong> option.<ul id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_ul728517146557"><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li1510553175318">In any case, if saving of the source file is failed due to some reasons, then user is prompted with the <strong id="EN-US_TOPIC_0000001860198725__b23837551354">Save As</strong> option to save the content as a new source file. If you choose not to save (that is cancelling <strong id="EN-US_TOPIC_0000001860198725__b56119673613">Save As</strong>), then File Terminal gets converted into an SQL Terminal.</li><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li232216118208">The changes made to File Terminals are not <strong id="EN-US_TOPIC_0000001860198725__b15404172819364">Auto Saved</strong>.</li></ul>
</li></ul>
</div></div>
</div>
</p></li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_section1197648113310"><h4 class="sectiontitle">Saving an SQL Script in New File</h4><p id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_p137202513338">The<strong id="EN-US_TOPIC_0000001860198725__b65482052173616"> Save As</strong> option saves the terminal content to a new file.</p>
</div>
<p id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_p1993285913217">Follow the steps to save an SQL script:</p>
<ol id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_ol8705141910340"><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li158971953219"><span>Perform any of the following operations:</span><p><ul id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_ul84816317220"><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li15481739223">Choose <strong id="EN-US_TOPIC_0000001860198725__b234632743711">File</strong> &gt; <strong id="EN-US_TOPIC_0000001860198725__b734732743714">Save as</strong>.</li><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li10489314227">Press Ctrl+Alt+S. (This operation supports saving SQL terminal contents and file terminal contents.)</li></ul>
<p id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_p913794712236">The <strong id="EN-US_TOPIC_0000001860198725__b14432194617379">Data Studio Security Disclaimer</strong> dialog box is displayed.</p>
</p></li><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li3556105515343"><span>Click <strong id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_b016511135155">OK</strong>.</span><p><p id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_p576012462508">The <strong id="EN-US_TOPIC_0000001860198725__b18430451382">Save As</strong> dialog box is displayed.</p>
</p></li><li id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_li85989579223"><span>Select the location to save the script and click <strong id="EN-US_TOPIC_0000001860198725__b7892174111399">Save</strong>.</span></li></ol>
<div class="note" id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_note135562400221"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001860198725__en-us_topic_0185264432_p3310135183216">When there are unsaved changes in File Terminals, user will be given an option to save or cancel on graceful exit of data studio.</p>
</div></div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="DWS_DS_025.html">SQL Terminal Management</a></div>
</div>
</div>