Must Declare the table variable "@table"?
<p>So this might just be a matter of me not knowing enough about Procedures, but I am trying to make a Procedure which update a Column in a Table to remove trailing spaces as it's a regular occurrence we are getting lately at work.</p>

<p>This is because we are in a transition phase from an old system to a new one, so we also made a new database to accompany this. The old Database used <s>nvarchar</s> nchar which means that even if you don't use all the slots for characters, it will fill the rest of the slots with spaces. In the new database though we use varchar so we want to get rid of white spaces!</p>

<p>So this is pretty handy:</p>

<pre><code>UPDATE table SET column = LTRIM( RTRIM( column ) );
</code></pre>

<p>So I tried to make a Procedure out of it as we have to use it once in a while:</p>

<pre><code>USE omitted
GO
CREATE PROCEDURE TrimTrailingSpaces
  @table  VARCHAR(50),
  @column VARCHAR(50)
AS
BEGIN
UPDATE @table
SET
    @column = LTRIM( RTRIM( @column ) );
END
GO
</code></pre>

<p>But whenever I try and execute this I get the error:</p>

<blockquote>
  <p>Msg 1087, Level 16, State 1, Procedure TrimTrailingSpaces, Line 6 [Batch Start Line 2]: Must declare the table variable "@table".</p>
</blockquote>

<p>Is what I am doing just not possible?</p>