In SQL Server, what is the best way to identify all rows in a table where a certain column contains the TAB
character (CHAR(9)
)
Is it as simple as
SELECT * FROM MyTable WHERE Field1 LIKE '%' + CHAR(9) + '%'
Use the SQL tab to create an SQL WHERE clause to handle selection criteria that are more complex than can be defined on the Selection Criteria tab. For example, to select the appropriate set of data for a table, you might need a combination of AND and OR logical operators.
LEN() function calculates the number of characters of an input string, excluding the trailing spaces. It is an expression that can be a constant, variable, or column of either character or binary data. Returns : It returns the number of characters of an input string, excluding the trailing spaces.
In this article, we covered the important SQL string functions TRIM and LENGTH to learn how to remove junk characters in SQL. If you want to detect hidden or unwanted characters as part of an initial diagnosis, use LENGTH . Then, use TRIM to get rid of unwanted characters.
select * from MyTable where Field1 '%' || CHR(9) || '%'; Other solution can be: Select * from MyTable where instr(Field1, CHR(9)) <> 0; Cheers!
RTRIM
CHAR columns. like this:
SELECT *
FROM MyTable
WHERE (RTRIM(Field1) LIKE '%' + CHAR(9) + '%')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With