Friday, 23 October 2015

Split first-name middle-name and last-name from full name using sql query


// using SUBSTRING

declare @name varchar(50)='krishna-chaturvedi'
SELECT top 2 SUBSTRING(@name, CHARINDEX('-', @name)+1, 8000)+'/' +SUBSTRING(@name, CHARINDEX('-', @name) + 1, 8000)

FROM mstuser


// using PARSENAME


declare @name varchar(100)= 'krishna-kumar-chaturvedi'
Select PARSENAME (Replace(@name,'-','.'),1)[LastName],
            PARSENAME (Replace(@name,'-','.'),2) [MiddleName],

            PARSENAME (Replace(@name,'-','.'),3)[FristName]

Tuesday, 20 October 2015

Encrypt password using sql server query with SHA and HASHBYTES



DECLARE @HashThis nvarchar(4000);
SELECT @HashThis = CONVERT(nvarchar(4000),'abc');

SELECT HASHBYTES('SHA1', @HashThis);

Encrypt and Decrypt password using sql server query



//1.   with query and parameter

declare @encrypt varbinary(200)
select @encrypt = EncryptByPassPhrase('key', 'abc' )
select @encrypt

select convert(varchar(100),DecryptByPassPhrase('key',@encrypt))


//2.   with query and direct value

declare @encrypt varbinary(200)
select @encrypt = EncryptByPassPhrase('key', 'abc' )
select @encrypt

select convert(varchar(100),DecryptByPassPhrase('key',0x01000000B97F1BA787918D419080AA009A4AC2B04628AFEAC1C1FBFD))

Tuesday, 6 October 2015

Rotate text inside gridview in asp.net using css for (IE,Mozial,Chrome etc.)

.verticaltext
{
/*I method
filter: flipH() flipV();
writing-mode: tb-rl;
height:128px;
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
width:50px;
*/
/*II method*/
position: relative;
 -moz-transform: rotate(270deg);  /* FF3.5+ */      
 -o-transform: rotate(270deg);  /* Opera 10.5 */  
 -webkit-transform: rotate(270deg);  /* Saf3.1+, Chrome */            
  filter:  progid:DXImageTransform.Microsoft.BasicImage(rotation=3);  /* IE6,IE7 */        
  -ms-filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); /* IE8 */
  height:150px;

}

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...