Solved

SQL Server Help - Is there an alternative to PatIndex

Posted on 2013-05-28
2
609 Views
Last Modified: 2013-06-14
In MS SQL Server, is there an alternative to PatIndex?  I have the Select Query below which currenly uses the PatIndex function but is there another way this can be with a different function? The purpose of this query is to identify invalid chars in a column.


SELECT *
FROM [Addresses.txt]
WHERE PatIndex('%[^a-z0-9]%', [Addresses.txt].[PROD_CD]) > 2
0
Comment
Question by:hojohappy
2 Comments
 
LVL 32

Expert Comment

by:awking00
ID: 39202440
Can you supply some sample data for prod_cd and what you expect to return?
0
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 500 total points
ID: 39202513
I don't know of any other built-in function that duplicates what PATINDEX() does.  After all, why would there need to be two built-in functions that did the same thing?!
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question