Setence Case using Javascript/SQL Server

How to  Change aaa or AAA to be Aaa

<script type="text/javascript" language="javascript">
    function CorrectName(e){
        if(e.value != "" && /^[a-zA-Z]/.test(e.value)){
           e.value=e.value.substring(0,1).toUpperCase()+e.value.substring(1).toLowerCase();
        }
        }
    </script>

<asp:TextBox onkeyup="CorrectName(this)" onblur="CorrectName(this);" ID="txtFirstName"
        runat="server" Width="130px" MaxLength="20"></asp:TextBox>

 

UPDATE TableName SET first_name=upper(first_name)
WHERE len(first_name)=1;

UPDATE TableName SET first_name=upper(left(first_name,1))+ lower(substring(first_name,2, len(first_name)-1))
WHERE len(first_name)>1;

posted @ 2009-10-02 17:08  emanlee  阅读(267)  评论(0编辑  收藏  举报