I want to trim all leading and trailing spaces for every dimension in a query, using custom SQL on MS-SQL DB, what i have tried thus far is generating errors on validate just for one dimension? any suggestions
fields seem to be both Text / char and number. Some appear empty but have char in them. Need to trim.
Have tried LTRIM(RTRIM(
Give me a error 'The data type of a column in the query is not valid" IES 10811)
Seems MS SQL does not have a general trim. Yes it would be better to do in ETL or Universe but not an option for this at this time. Would be a major project I need answers this week.
Use a combination of ltrim(rtrim(colname)) and casting/converting to get the table you want:
create view v_table1 AS
select
cast(ltrim(rtrim(col1)) as int) col1_int,
cast(ltrim(rtrim(col2)) as varchar(20)) col2_vc20,
…
cast(ltrim(rtrim(col10)) as date) col10_date
from
table1 WITH (NOLOCK)