First Char is in Uppercase


                  To Find  string is completely in uppercase?
                                                  or
if First Char is in Uppercase

Im my previous Project i need to find that string first char are upper or not and according that need to make that row active or in active
Let me Show you How to do that


---Create Table

create table duplicatetest(
id int identity(1,1),
name varchar(max),
Active int )



  ---Insert Some Record

          insert into duplicatetest(name,Active) values('krishna patil',1)
          insert into duplicatetest(name,Active) values('Mitesh patil',1)
          insert into duplicatetest(name,Active) values('Rahul Joshi',1)
          insert into duplicatetest(name,Active) values('krishna patil',1)
     insert into duplicatetest(name,Active) values('sagar Patel',1)
      insert into duplicatetest(name,Active) values('Mitesh patil',1)

To check first char is in Upper use following Query

update duplicatetest set active=0 where ASCII(substring(name,1,1))=ASCII(upper(substring(name,1,1) ))


Categories:

0 comments:

Post a Comment