Convert Text to INT in SQL
<p><code>sm_Value</code> is a <code>TEXT</code> column which I need to convert to <code>INT</code>.</p>

<p>Being the fact that only two people will mess with this table, the column will be numerical (humor me)</p>

<p>I'm getting this error message:</p>

<blockquote>
  <p>Msg 206, Level 16, State 2, Procedure User_Password_Date_Interval_Check, Line 10<br>
  Operand type clash: text is incompatible with int</p>
</blockquote>

<p>I have tried:</p>

<pre><code>SELECT CONVERT(INT, sm_Value)) 
FROM Setting_Misc
</code></pre>

<p>But I still get the error.</p>

<pre><code>IF EXISTS (SELECT * FROM sysobjects 
           WHERE type = 'P' AND name = 'User_Password_Date_Interval_Check')
BEGIN
    PRINT 'Dropping Procedure User_Password_Date_Interval_Check'
    DROP  Procedure  User_Password_Date_Interval_Check
END
GO

PRINT 'Creating Procedure User_Password_Date_Interval_Check'
GO

CREATE Procedure User_Password_Date_Interval_Check
    @ua_pk uniqueidentifier
AS
    DECLARE @PasswordExpireDays INT

    SELECT 
        CONVERT(INT, CONVERT(VARCHAR(MAX), sm_Value)) 
    FROM Setting_Misc

    SELECT
        @PasswordExpireDays = COALESCE(sm_Value,0)
    FROM
        Setting_Misc AS sm
    INNER JOIN
        Syndicates As syn ON sm.syn_fk = syn.syn_pk
    INNER JOIN
        Company As c ON c.syn_fk = syn.syn_pk
    INNER JOIN
        User_Accounts As ua ON ua.c_fk = c.c_pk
    WHERE 
        sm.sm_Setting = 'PasswordExpireDays'
GO

GRANT EXEC ON User_Password_Date_Interval_Check TO WEB
</code></pre>