Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Remove duplicate characters from a string

Dec 29 2007 7:05AM by Madhivanan   

Pinal Dave in his weblog posted about Remove Duplicate Chars From String Here is its alternate method with Number table approach

create procedure remove_duplicate_characters(@string varchar(100))
as
Declare @result varchar(100)

set @result=''
select @result=@result+min(substring(@string ,number,1)) from 
( 
    select number from master..spt_values where type='p' and number between 1 and len(@string )) as t group by substring(@string,number,1)order by min(number)

select @result 

GO

Execute the procedure

EXEC remove_duplicate_characters 'aasssarrrty' 

-- Result

asrty 

Tags: t-sql, sql_server, string, duplicate,


Madhivanan
3 · 40% · 12899
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

1  Comments  

  • Hi I tried the above code with a small change, I declared the datatypes of the variable as varchar(max), but the output i am getting is wrong. I didn't understand what the problem is. When it is given size as 100 it is working correctly. Can you please help me. I want be more clear regarding this. The input string I provided is 'sireesha' and the output I am getting as 'a'.

    Thanks in advance, Naga Sireesha

    commented on May 3 2013 4:12AM
    NagaSireesha
    3050 · 0% · 2

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]