Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

SQL IS testing Expand / Collapse
Author
Message
Posted Monday, April 15, 2013 1:58 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 12:52 PM
Points: 13,069, Visits: 11,907
Well you could create your own IsAlpha. I would extend the version you found to at least include spaces and periods.

something like this might help you along.

declare @ScalarVal varchar(100) = '123.'

select case when @ScalarVal not like '%[^a-z0-9 .]%' then 1 else 0 end as IsAlpha

You could turn that into a function if you wanted.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1442486
Posted Monday, April 15, 2013 2:02 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Today @ 7:06 AM
Points: 384, Visits: 1,512
Sean Lange (4/15/2013)
Well you could create your own IsAlpha. I would extend the version you found to at least include spaces and periods.

something like this might help you along.

declare @ScalarVal varchar(100) = '123.'

select case when @ScalarVal not like '%[^a-z0-9 .]%' then 1 else 0 end as IsAlpha

You could turn that into a function if you wanted.


It does. Thanks.
Post #1442488
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse