title: How can I reduce the table size in SQL Server?
body: <p>I have SQL Server 2016 (v13.0.4001.0) 64-bit on a Windows server. The database consists of 7 tables, 6 of them a really small (it's a few rows with configurations) and one main table with the data, that not mapped with the others tables. </p>
  
  <p>Yesterday I got an error </p>
  
  <blockquote>
    <ol start="1827">
    <li>Could not allocate space for object 'dbo.table'.'PK_table' in database 'dbname' because the 'PRIMARY' filegroup is full.</li>
    </ol>
  </blockquote>
  
  <p>So I'm looking for the simplest way to solve that (I'm quite a newbee on that, and it'd be good find simple solution).</p>
  
  <p>What I expect: I need to reduce size of the db (or the my main table) on 2-3 gb. This place is enough for 1-2 years working of my application. </p>
  
  <p>Options I found:</p>
  
  <ol>
  <li><p>MS shared dev. version of SQL Server <a href="https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-clean-db-free-space-transact-sql?view=sql-server-2017" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-clean-db-free-space-transact-sql?view=sql-server-2017</a> and it doesn't have the 10gb restriction. It's a bit hard way, because I have to install and setup it manually on the 8 machines. I've already tried and it's not so easy, because I got this error<a href="https://i.stack.imgur.com/4p148.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4p148.jpg" alt=""></a>. </p></li>
  <li><p>Use shrink. I'm not exactly sure that it's safe for main data, because I've used that only for logs earlier. But as far as I understand it'd work for me, because my databases work by years without any outer actions. I mean no one work with it\clear it\etc.</p></li>
  <li><p>I'm not sure as well, but I found out <code>sp_clean_db_free_space</code> ( <a href="https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-clean-db-free-space-transact-sql?view=sql-server-2017" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-clean-db-free-space-transact-sql?view=sql-server-2017</a> ). From describing I got that it can be used for my issue. Maybe I'm wrong.</p></li>
  </ol>
  
  <p>Also about my main table:</p>
  
  <p>result of <code>exec sp_spaceused &lt;table_name&gt;</code></p>
  
  <p><a href="https://i.stack.imgur.com/5jHsF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5jHsF.jpg" alt="first"></a></p>
  
  <p>result of common report for table from ssms:</p>
  
  <p><a href="https://i.stack.imgur.com/fn3CP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fn3CP.png" alt="second"></a></p>