snipt

Ctrl+h for KB shortcuts

SQL

Get SQL Server information

1
2
3
SELECT name FROM sysobjects WHERE xtype = 'U'; -- Tables
SELECT name FROM sysobjects WHERE xtype = 'V'; -- Views
SELECT name FROM sysobjects WHERE xtype = 'P'; -- Stored Procedures
https://snipt.net/embed/78fe9ce2e28c4a2f32d4e528b60f424b/
https://snipt.net/raw/78fe9ce2e28c4a2f32d4e528b60f424b/
78fe9ce2e28c4a2f32d4e528b60f424b
sql
SQL
3
2016-09-21T20:11:41
True
False
False
May 07, 2013 at 12:00 PM
/api/public/snipt/60862/
get-sql-server-information
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="k">SELECT</span> <span class="n">name</span> <span class="k">FROM</span> <span class="n">sysobjects</span> <span class="k">WHERE</span> <span class="n">xtype</span> <span class="o">=</span> <span class="s1">&#39;U&#39;</span><span class="p">;</span> <span class="c1">-- Tables</span> </span><span id="L-2"><a name="L-2"></a><span class="k">SELECT</span> <span class="n">name</span> <span class="k">FROM</span> <span class="n">sysobjects</span> <span class="k">WHERE</span> <span class="n">xtype</span> <span class="o">=</span> <span class="s1">&#39;V&#39;</span><span class="p">;</span> <span class="c1">-- Views</span> </span><span id="L-3"><a name="L-3"></a><span class="k">SELECT</span> <span class="n">name</span> <span class="k">FROM</span> <span class="n">sysobjects</span> <span class="k">WHERE</span> <span class="n">xtype</span> <span class="o">=</span> <span class="s1">&#39;P&#39;</span><span class="p">;</span> <span class="c1">-- Stored Procedures</span> </span></pre></div> </td></tr></table>
sql, sql-server

SQL

Sql Server Monitor TempDb

1
2
3
select * from sys.dm_db_file_space_usage
select * from sys.dm_db_task_space_usage
select * from sys.dm_db_session_space_usage 
https://snipt.net/embed/ba07ec11b5eb89fc257e6332f9a9617e/
https://snipt.net/raw/ba07ec11b5eb89fc257e6332f9a9617e/
ba07ec11b5eb89fc257e6332f9a9617e
sql
SQL
3
2016-09-22T13:09:41
True
False
False
/api/public/snipt/44225/
sql-server-monitor-tempdb
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="k">select</span> <span class="o">*</span> <span class="k">from</span> <span class="n">sys</span><span class="p">.</span><span class="n">dm_db_file_space_usage</span> </span><span id="L-2"><a name="L-2"></a><span class="k">select</span> <span class="o">*</span> <span class="k">from</span> <span class="n">sys</span><span class="p">.</span><span class="n">dm_db_task_space_usage</span> </span><span id="L-3"><a name="L-3"></a><span class="k">select</span> <span class="o">*</span> <span class="k">from</span> <span class="n">sys</span><span class="p">.</span><span class="n">dm_db_session_space_usage</span> </span></pre></div> </td></tr></table>
sql, sql-server, tempdb
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.