A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
Can you help me with a query which gives previous month data and at the same time delete current month data
Not sure what you actually want. However, if it is a Table_Valued UDF, why not add a where filter to remove datas of current month.
select <column_list>
from fn_UDF_Name()
where date_column < dateadd(month,datediff(month,0,getdate()),0)
Best regards,
LiHong