• Thanks for everyone who helped, I finally got it working just before end of the day yesterday.

    Just one more question, does anyone know the syntax to use this in a view?

    I have:

    CREATE VIEW view_name

    As

    Declare..........

    ....................

    This is where my code starts, but it says incorrect syntax near Declare.