IS it possible to use the 'Where' clause in SQL to only show a field containing only letters & Numbers?

前端 未结 5 721
攒了一身酷
攒了一身酷 2021-01-14 07:56

I want to be able to select only the field where a certain field contains both letters and numbers. for example:

Select [field1], [field2] 

from [db1].[tabl         


        
5条回答
  •  隐瞒了意图╮
    2021-01-14 08:00

    What you would want to do is SQL-based regexp matching. Check this out: http://msdn.microsoft.com/en-us/magazine/cc163473.aspx

    Quotes:

    "Although T-SQL is extremely powerful for most data processing, it provides little support for text analysis or manipulation. Attempting to perform any sophisticated text analysis using the built-in string functions results in massively large functions and stored procedures that are difficult to debug and maintain."

    And:

    "However there's SQLCLR, a CLR user-defined function (UDF) that lets you create an efficient and less error-prone set of functions using the Microsoft® .NET Framework."

    Then you get code examples. Isn't Microsoft great? :D

提交回复
热议问题