August 13, 2009 at 2:58 pm
table
employeeid, employeename
112,test
,test1 (where employeeid is 3 spaces)
how do i eliminate this row in my query.
if i do is not null it doesnt work it still picks as there are spaces there.
August 13, 2009 at 3:15 pm
I think you are wanting to elminate rows that only contain spaces?
simply add where [Field] ''
SQL treats multiple spaces in a field as an empty string. Alternately you could LTrim(RTrim([Field]))
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 13, 2009 at 3:16 pm
SELECT LTRIM(employeeid) AS employeeID, employeename
FROM dbo.[Table]
WHERE (LTRIM(employeeid) '')
will remove all leading spaces
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
August 13, 2009 at 3:20 pm
where employeeid not like '% %'
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply