• Hi - you've got some missing brackets here. You can either use:-

    exec (@SQL)

    or

    exec sp_executesql @SQL

    If you use the second method you will have to declare @sql as ntext, nchar or nvarchar

    -------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
    There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
    I would never join a club that would allow me as a member - Groucho Marx