Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Script to determine if all chars are same in field

By hneal_98,

This script is actually based on a script by epol29.  That was titled 'Script to count the number of Yes/No in the string', which I found to be an awsome script.

Anyway, this script uses the same logic to deterimine if all of the characters in a field are the same.  For example, 1111111, aaaaaaaa, 4444, 22, 77777.

It works by replacing all chars by that match the first char with a blank.  If all chars are replaced, you are left with a zero length result.  So, all you have to do is check to see if the length is 0, if it is, then true, else false.

Hope this helps someone.

Total article views: 128 | Views in the last 30 days: 1
 
Related Articles
FORUM

Monitoring script

script

FORUM

Script

Need Automated Script

FORUM

drop script

drop script

FORUM

Script component

Script component

Tags
miscellaneous    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones