Home Forums SQL Server 2008 SQL Server Newbies View not working since moving database from SQL 2000 to SQL 2008 RE: View not working since moving database from SQL 2000 to SQL 2008

  • What is the datatype of PERSONNUM?

    You can change this in the WHERE clause:

    WHERE (EMPLOYMENTSTATUS = 'Active') AND (CONVERT(numeric, PERSONNUM) = 722)

    to this, where DATATYPE is the datatype of PERSONNUM, e.g. VARCHAR(20) or NVARCHAR(50), which will make that part a SARG:

    WHERE (EMPLOYMENTSTATUS = 'Active') AND (PERSONNUM = CAST('722' AS DATATYPE))

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato