1-- Create a copy with a recalculated age column2SELECT *,3DATEDIFF(year, anon_date_of_birth, GETDATE()) AS Recalculated_Age4INTO Project_12345_Working..Demog5FROM Project_12345..Demography_Current67-- To refresh the age column later:8UPDATE Project_12345_Working..Demog9SET Recalculated_Age = DATEDIFF(year, anon_date_of_birth, GETDATE())
1with engine.connect() as conn:2 df = pd.read_sql("SELECT * FROM Project_12345..Demography_Current", conn)34# anon_date_of_birth is already a datetime column5df["Recalculated_Age"] = (6 pd.Timestamp.now().year - df["anon_date_of_birth"].dt.year7)89df.head()