To get a date in the YYYY-MM-DD format from a TSQL query using the CONVERT function, you can use the following syntax:
SELECT CONVERT(VARCHAR, GETDATE(), 23) AS DateInYYYYMMDDFormat;
Explanation:
CONVERT: Converts a value from one data type to another.
VARCHAR: Specifies the data type of the output (you can adjust this to the format you prefer).
23: A style code in SQL Server for the YYYY-MM-DD format.
This will return the current date in the YYYY-MM-DD format.