• i just tested it in 2008R2, 2005, and compatibility 80.

    the database you are testing in is set for compatibility 80 instead of 90.

    in SQL2000 (80), functions were not allowed, and that's why you get the syntax error;

    change your database compatibility.

    EXEC dbo.sp_dbcmptlevel @dbname=N'SANDBOX', @new_cmptlevel=90

    try it in tempdb if you want, and it works fine, since tempdb will be the version of the server.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!