SARAVAN
SARAVAN

Reputation: 15031

SQL server retrieve table rows based on a single column that contains special/garbage characters

I have a InsuranceDetails SQL table, one of the column is VIN whose type is varchar(20). Ideally this column should contain only Alphanumeric values (Upper case and lower case allowed) as you might know about a typical VIN number.

For some reason this field gets some garbage values during insert.

I need to write a query that will get the rows in InsuranceDetails table which contains garbage/special characters in VIN Column.

Any help would be appreciated!!!

Upvotes: 0

Views: 371

Answers (1)

gbn
gbn

Reputation: 432210

...LIKE '%[^A-Z0-9]%'

Looks for any character not alphanumeric in the string

Upvotes: 2

Related Questions