I am trying to clean my data on SQL. My sample data is below:
Could you please let me know how can I remove the date-time parts? Thanks,
https://docs.google.com/spreadsheets/d/1BvVxU0_a53vncGpd0Mbr57WPUbG89MgfpYGah0JBdIA/edit?usp=sharing
I am trying to clean my data on SQL. My sample data is below:
Could you please let me know how can I remove the date-time parts? Thanks,
https://docs.google.com/spreadsheets/d/1BvVxU0_a53vncGpd0Mbr57WPUbG89MgfpYGah0JBdIA/edit?usp=sharing
SQL Server is not particularly good at string manipulations.
However, based on the examples in your question, the "cleaning" is either removing the first 11 characters or the last 13 characters, depending on where the date is. Fortunately, this is actually something you can do in SQL Server:
select t.*,
(case when data like '% ([0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9])'
then left(data, len(data) - 13)
when data like '[0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9] %'
then stuff(data, 1, 11, '')
else data
end) as cleaned_data
from t;