• Sean

    I've tried your script but get a whole load of errors (see below). I'd be grateful for your help as your report looks really useful.

    Msg 170, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 29

    Line 29: Incorrect syntax near 'MAX'.

    Msg 170, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 30

    Line 30: Incorrect syntax near 'MAX'.

    Msg 156, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 37

    Incorrect syntax near the keyword 'TABLE'.

    Msg 170, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 39

    Line 39: Incorrect syntax near 'MAX'.

    Msg 170, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 40

    Line 40: Incorrect syntax near 'MAX'.

    Msg 170, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 41

    Line 41: Incorrect syntax near 'MAX'.

    Msg 137, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 45

    Must declare the variable '@vRecipients'.

    Msg 137, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 46

    Must declare the variable '@vCopy_Recipients'.

    Msg 137, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 62

    Must declare the variable '@vXML_String'.

    Msg 137, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 69

    Must declare the variable '@vBody'.

    Msg 170, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 145

    Line 145: Incorrect syntax near 'MAX'.

    Msg 156, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 159

    Incorrect syntax near the keyword 'FOR'.

    Msg 137, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 185

    Must declare the variable '@vBody'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 185

    Must declare the variable '@vBody'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 213

    Must declare the variable '@vFixed_Drives_Free_Space_Table'.

    Msg 170, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 228

    Line 228: Incorrect syntax near 'MAX'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 234

    Must declare the variable '@vFixed_Drives_Free_Space_Table'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 243

    Must declare the variable '@vBody'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 257

    Must declare the variable '@vBody'.

    Msg 137, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 345

    Must declare the variable '@vSQL_String'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 345

    Must declare the variable '@vSQL_String'.

    Msg 170, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 363

    Line 363: Incorrect syntax near 'MAX'.

    Msg 156, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 375

    Incorrect syntax near the keyword 'ORDER'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 383

    Must declare the variable '@vBody'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 402

    Must declare the variable '@vBody'.

    Msg 195, Level 15, State 10, Procedure usp_SSAJ_SQL_Server_System_Report, Line 443

    'ROW_NUMBER' is not a recognized function name.

    Msg 170, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 468

    Line 468: Incorrect syntax near 'MAX'.

    Msg 156, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 489

    Incorrect syntax near the keyword 'ORDER'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 498

    Must declare the variable '@vBody'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 517

    Must declare the variable '@vBody'.

    Msg 195, Level 15, State 10, Procedure usp_SSAJ_SQL_Server_System_Report, Line 563

    'ROW_NUMBER' is not a recognized function name.

    Msg 170, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 584

    Line 584: Incorrect syntax near 'A'.

    Msg 170, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 597

    Line 597: Incorrect syntax near 'MAX'.

    Msg 156, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 612

    Incorrect syntax near the keyword 'ORDER'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 621

    Must declare the variable '@vBody'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 640

    Must declare the variable '@vBody'.

    Msg 170, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 723

    Line 723: Incorrect syntax near 'MAX'.

    Msg 156, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 734

    Incorrect syntax near the keyword 'ORDER'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 742

    Must declare the variable '@vBody'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 760

    Must declare the variable '@vBody'.

    Msg 137, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 877

    Must declare the variable '@vSQL_String'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 877

    Must declare the variable '@vSQL_String'.

    Msg 170, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 895

    Line 895: Incorrect syntax near 'MAX'.

    Msg 156, Level 15, State 1, Procedure usp_SSAJ_SQL_Server_System_Report, Line 907

    Incorrect syntax near the keyword 'ORDER'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 918

    Must declare the variable '@vBody'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 937

    Must declare the variable '@vBody'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 971

    Must declare the variable '@vBody'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 979

    Must declare the variable '@vBody'.

    Msg 137, Level 15, State 2, Procedure usp_SSAJ_SQL_Server_System_Report, Line 988

    Must declare the variable '@vRecipients'.