• Rich.Gamble (7/15/2008)


    Provided script failed to create sp_utl_FindMisMatchedObjects in SQL Server 2005 with the following error:

    Msg 4145, Level 15, State 1, Procedure sp_utl_FindMisMatchedObjects, Line 26

    An expression of non-boolean type specified in a context where a condition is expected, near 'or'.

    Msg 102, Level 15, State 1, Procedure sp_utl_FindMisMatchedObjects, Line 27

    Incorrect syntax near ')'.

    -- End of Post.

    Change

    if(not (select * from sys.databases WHERE name =@strDBName1)

    or not exists(select * from sys.databases WHERE name =@strDBName2)

    to

    if(not exists (select * from sys.databases WHERE name =@strDBName1)

    or not exists(select * from sys.databases WHERE name =@strDBName2)

    Otherwise, a handy procedure.

    PS: it doesn't run in 2000, only in 2005.