April 23, 2015 at 3:08 am
Hi Team,
using below script to read two column from a text file and trying to trim the spaces for file_name.
but trimming is not happening
bulk insert #O_P
from 'C:\Users\TKT\\PA.txt'
with (fieldterminator = ',',rowterminator = '')
END
INSERT INTO O_P (file_name,location)
SELECT LTRIM(RTRIM(file_name)), location From #O_P
Please help
April 23, 2015 at 3:29 am
What do you mean "trim is not happening"? Do you still see the whitespace chars? Are you sure it's a whitespace? It could be any other non-representable char: check what ASCII(char) returns.
-- Gianluca Sartori
April 23, 2015 at 3:34 am
Check up what shpaghettidba suggested to, and you can additionally use the REPLACE() function to replace those non-visible characters (usually char(9), char(10) and char(13)) with whitespaces and then TRIM them.
Igor Micev,My blog: www.igormicev.com
April 23, 2015 at 4:51 am
Check UNICODE() of the problem symbol and collation. Under some collations ASCII=32 doesn't mean UNICODE =32 which is required for trim() functions.
April 23, 2015 at 4:53 am
serg-52 (4/23/2015)
Check UNICODE() of the problem symbol and collation. Under some collations ASCII=32 doesn't mean UNICODE =32 which is required for trim() functions.
Great catch!
-- Gianluca Sartori
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply