Product:
Microsoft SQL Azure
Issue:
How remove all rows of data from table when the date column is INT and contain both year and date?
Suggested solution:
In SQL SSMS write like this (to erase all rows with year 2024) :
DELETE FROM [DM].[dbtablename] where 1=1 and SUBSTRING (( CAST ( [key_dimdate] AS varchar) ), 1 , 4 ) = '2024'
if the key_dimdate format is ‘20240112’ as a INT
More Information:
https://www.w3schools.com/sql/func_sqlserver_cast.asp
https://learn.microsoft.com/en-us/sql/t-sql/functions/substring-transact-sql?view=sql-server-ver16