Below query which insert records to the Table does not trim the empty space.
Insert into MyTable (MyColumn)
select RTRIM(LTRIM(rowvalue)) from #temptable
Alternatively, if i assign to a variable and insert back, empty spaces are trimmed.
Declare @var varchar(max)
set @var = ( select RTRIM(LTRIM(rowvalue)) from #temptable )
go
Insert into MyTable (MyColumn) values ( @var)
Instead of assigning, is there a way to trim the empty spaces in the Insert query.