Home » SQL & PL/SQL » SQL & PL/SQL » SQL - spaces in COLs
SQL - spaces in COLs [message #391398] Thu, 12 March 2009 02:05 Go to next message
Maverick27
Messages: 84
Registered: October 2008
Member
Can somebody pls. remind the syntax for removing spaces in column when joining SQLs.

I suspect that it definitely the issue of space for the discrepancy in the SQL statements as per attachment.

So when i am joining 2 matching columns from tables i want to get the correct result.

Mave
  • Attachment: sql.jpg
    (Size: 29.70KB, Downloaded 428 times)

[Updated on: Thu, 12 March 2009 02:09]

Report message to a moderator

Re: SQL - spaces in COLs [message #391400 is a reply to message #391398] Thu, 12 March 2009 02:23 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
TRIM
Note however that using trim (or any other function) on your column will mean that any index on that column can not be used, whereas like will still use that index (if you don't use wildcards at the start).

[Updated on: Thu, 12 March 2009 02:26]

Report message to a moderator

Re: SQL - spaces in COLs [message #391417 is a reply to message #391400] Thu, 12 March 2009 04:02 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
If this is a persistent problem, then I'd consider either
1) fixing the code that keeps adding/allowing spaces into these fields
2) adding insert & update triggers to the table to trim the spaces off the fields when they are inserted/updated, and doing a global update on the columns to remove any spaces.
Previous Topic: Stuck in buffer overflow
Next Topic: updating multiple rows in loop
Goto Forum:
  


Current Time: Sat Dec 07 03:39:40 CST 2024