Skip to content
Advertisement

SQL select where column begins with Letters

I have a table tbl1 with row of data:

I want to query the the Legal_Doc_No of each ID. The value of each ID is either the TIN or the SSS column.

How can I query the TIN and SSS column starting with letters (none) so that only values starting with numbers will be assigned to Legal_Doc_No

Advertisement

Answer

Most databases support left(), so you can do something like this:

Depending on the database, there might be other solutions.

In SQL Server, you can do:

If you have a case-sensitive collation, then you’ll need to take that into account:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement