rowmark
asked on
LTrim in SQL Server not working
Hello experts,
I have a table in which for one of the colums there is a space and becos of that all the records that have space are appearing on the top in my dropdownlist
In spite of using LTrim(RTrim(Name)
or just LTrim
my problem is not solved please help
I have a table in which for one of the colums there is a space and becos of that all the records that have space are appearing on the top in my dropdownlist
In spite of using LTrim(RTrim(Name)
or just LTrim
my problem is not solved please help
Select ID, Name from EmployerGroups order by Name
ASKER
Thanks aneesh.. I did update all the records even then some are not fixed.. How can I fix this issue
> some are not fixed
can u provide some sample data
can u provide some sample data
ASKER
Below are the records:
if you look at the first 4 records there is a space
Thank
19C00C68-FE9D-43BA-B0F3-02 3A19DC74AA
E9776B45-AE35-459E-ABEF-D1 01D13A3A2F
52C95EF6-862C-4352-801E-99 4437ABC5FD David Andrews
FC5AECE4-E922-483D-BC4D-9A C88364EC95 Equities
58EA0141-D34C-413C-B98E-C1 9E32641DB3 NewOne
B3B3E3EF-E091-491D-AA08-D6 4DEE0D4681 Samuel Adams
5786800F-E500-49D1-837B-93 99817E7DDA AAA MidAtlantic
F92E56D4-0998-4505-A98B-B2 C3CEA17009 Abe Smith
11790D20-6009-43C0-9FA4-CA B7AA781406 ADP
8FFEFE80-7AC6-45BA-8634-83 5AD2092106 Alan Steinthal
90A82FC4-80F9-416A-BCC0-6F 453914732D Alex Betinski
if you look at the first 4 records there is a space
Thank
19C00C68-FE9D-43BA-B0F3-02
E9776B45-AE35-459E-ABEF-D1
52C95EF6-862C-4352-801E-99
FC5AECE4-E922-483D-BC4D-9A
58EA0141-D34C-413C-B98E-C1
B3B3E3EF-E091-491D-AA08-D6
5786800F-E500-49D1-837B-93
F92E56D4-0998-4505-A98B-B2
11790D20-6009-43C0-9FA4-CA
8FFEFE80-7AC6-45BA-8634-83
90A82FC4-80F9-416A-BCC0-6F
SELECT * FROM EmployerGroups
WHERE LEN(Name) <> LEN(LTrim(RTrim(Name))
WHERE LEN(Name) <> LEN(LTrim(RTrim(Name))
ASKER
The above query is returning 0 records..
i think it must be some other charecters, it is not the space
SELECT ASCII(Name) FROM EmployerGroups WHERE <PrimaryKEy of those 4 records >
SELECT ASCII(Name) FROM EmployerGroups WHERE <PrimaryKEy of those 4 records >
ASKER
NULL
NULL
160
160
160
160
160
65
NULL
160
160
160
160
160
65
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect. Thanks
UPDATE EmployerGroups
SET Name = LTrim(RTrim(Name)