Hehehe ... no problem, second-pair-of-eyes always makes spotting that easy.
I've got a couple of other suggestions:
Don't use "tbl" prefix. When you decide to massively revamp the
tblInvoiceHeader table, and for backward compatibility you need a "version 1" table, the straightforward choice will be to create
tblInvoiceHeader_V2, with all the column name changes, data type alterations, and you might also sequence the columns in a different order, etc. and so on.
If it was me I would RENAME the existing table
tblInvoiceHeader_V2, make all the changes, and then so that all my old, legacy, code would work I would create a VIEW with the old
tblInvoiceHeader name (and all the original Column namaes, in the original order, etc. etc.) and Hey Presto all my old, legacy, code would still work.
But now that
tblInvoiceHeader is a VIEW, and no longer a table, the "tbl" prefix is confusing and will lead to programming errors.
Just call your tables
I recommend that you ALIAS your table, rather than using the name in full:
IsNull(I.InvoiceTicketText,'None') as PrintGroup
,count(*) as Invoices,
FROM tblInvoiceHeader AS I
where I.InvoiceType = 'G'
AND I.InvoiceSageBatch = @ISB
when you have to self-reference a table, or for some other reason have a table appearing twice, or more, in your FROM / JOIN statements, you will have to alias it, and having the name in full will just mean that you have double-standards between "simple code" and "complex code".
Better to start now with simple ALIAS names for tables.