Monday 14 April 2014

Get Character Index in sql server

1-Get Index of character
select CHARINDEX('FindWhat','String expression')
select CHARINDEX('1','0001')

Result-4

2- Get character of particular Index
select CHARINDEX('FindWhat','String expression',Index)

select CHARINDEX('1','000000000',1)
Result-0
select CHARINDEX('1','100000010',1)
Result-1
select CHARINDEX('1','100000010',2)
Result-8




Sunday 13 April 2014

Leave Last char of a string using sql server

from left-

SELECT LEFT('Name1', LEN('Name1')-1)
Result-Name

from right-

SELECT RIGHT('Name1', LEN('Name1')-1)
Result-ame1

Monday 7 April 2014

Repeats a string value a specified number of times in sql server

REPLICATE ( string_expression ,integer_expression ) 

select-select rtrim(Columns Name) +REPLICATE(' ',Total Length- LEN( rtrim(Columns Name)))+'1' 
from tblMstVFAMem where len(Columns Name)>0 and Columns Name is not null

update-update TableName  set Assets_F= rtrim(Columns Name) +REPLICATE(' ',Total Length- LEN( rtrim(Columns Name)))+'1' 
 where len(ColumnsName)>0 and ColumnsName is not null

Wednesday 2 April 2014

fixed after decimal in javascript

var num1 = "2";
document.getElementById('num1').innerHTML = parseFloat(Math.round(num1 * 100) / 100).toFixed(2);

var num2 = "1.341";
document.getElementById('num2').innerHTML = parseFloat(Math.round(num2 * 100) / 100).toFixed(2);

var num3 = "2.345945829374985723";
document.getElementById('num3').innerHTML = parseFloat(Math.round(num3 * 100) / 100).toFixed(2);

Tuesday 1 April 2014

Configure IIS and redirect to http to https 6,7,8











Reference-http://www.jppinto.com/2009/04/automatically-redirect-http-requests-to-https-iis-7/

Update progress bar using update progress ajax asp.net

<asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="0">
               <ProgressTemplate>
                   <div id="IMGDIV11" runat="server" align="center" style="visibility: visible; 
                       vertical-align: middle; width: 100%; position:fixed; height:100%; 
                       z-index: 999999; margin-top: -150px; margin-left: -10px;"
                      valign="middle" class="modalBackground">
                       
                       <asp:Image ID="Image11" runat="server" Style="position: relative; top: 40%; left: 0px;"
                           Height="120px" ImageUrl="~/Images/progress2.gif" />
                   </div>
                   
               </ProgressTemplate>
           </asp:UpdateProgress>

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...