Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

use SQL to find data with a fixed data length within column

column( A) in a database of datatype nchar with a data length of 32 i.e. nchar(32)

can some suggest suggest SQL to find rows with data length of fixed 30 characters in this column A?

Cheers
GMac
0
gerrymac1943
Asked:
gerrymac1943
1 Solution
 
Jerry MillerCommented:
This should work:

SELECT * FROM table_name WHERE LEN(columnA) = 30
0
 
jonnidipCommented:
Maybe you will need to add ltrim and rtrim to your column;
select * from table where len(ltrim(rtrim(columnA))) = 30
0
 
gerrymac1943Author Commented:
genius
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now