Posts

Showing posts from November, 2016

Remove First and last comma from string in SQl

Remove First and last comma from string in SQl   declare @Str nvarchar ( max )= ',kandy,'   if (right( rtrim ( @Str ), 1 ) = ',' ) begin          set @Str = substring ( rtrim ( @Str ), 1 , len ( rtrim ( @Str ))- 1 )   end if (left( ltrim ( @Str ), 1 ) = ',' ) begin        set @Str = Substring ( @Str , 2 , ( len ( @Str ))) end select @Str

Replace Enter key from string in Sql

Replace Enter key from string  in Sql declare @C nvarchar ( max ) set @C = 'kandy deol' select @C as WithEnterKey select REPLACE ( REPLACE ( @C , CHAR ( 13 ), '' ), CHAR ( 10 ), '' ) as WithOutEnterKey