Link to home
Start Free TrialLog in
Avatar of Neil Thompson
Neil ThompsonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

append the current year to a table name in a SQL request SQL Server 2012


I'm trying to automate a lookup on a table based on the current year, after some help as this doesn't seem to work. I want the year appended to the table name

example: FROM t_refuse_garden_2019

SELECT count(green_uprn) AS a 
FROM t_refuse_garden_YEAR(getdate())
WHERE green_uprn  = '12345678' 
AND green_end_date is null

Open in new window

Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Neil Thompson


Superb, many thanks