I inherited a table with identifiers in a format [nonnumericprefix][number]. For example (ABC123; R2D2456778; etc). I was wondering if there was a good way to split this in SQL into two fields, the largest integer formed from the right side, and the prefix, for example (ABC, 123; R2D, 2456778; etc). I know I can do this with a cursor, C# code, etc - and I will if I have to - but I don't run into things I cannot do fast and easily in SQL very often, so I thought I'd post it here.
相关问题
- sql execution latency when assign to a variable
- Correctly parse PDF paragraphs with Python
- how to split a list into a given number of sub-lis
- What is the best way to cache a table from a (SQL)
- php PDO::FETCH_ASSOC doesnt detect select after ba
相关文章
- JSP String formatting Truncate
- Entity Framework 4.3.1 failing to create (/open) a
- How to truncate seconds in TSQL?
- Selecting only the first few characters in a strin
- How do I get from a type to the TryParse method?
- Code for inserting data into SQL Server database u
- Python: print in two columns
- Delete Every Alternate Row in SQL
You could try something like
Code sample
You can use
PATINDEX
with a pattern like'%[^0123456789]%'
or'%[^0-9]%'
to find the position of the first non-numeric character