Replace

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • qhjghz
    New Member
    • Aug 2007
    • 26

    Replace

    Hi all,
    I have read about the REPLACE function and it seems alright. But, can anyone tell me what the following piece of code does?

    select @a='DebasisDas'
    select @a=REPLACE(@a,c har(10),'b')

    I don't find any differences
  • ak1dnar
    Recognized Expert Top Contributor
    • Jan 2007
    • 1584

    #2
    Originally posted by qhjghz
    Hi all,
    I have read about the REPLACE function and it seems alright. But, can anyone tell me what the following piece of code does?

    select @a='DebasisDas'
    select @a=REPLACE(@a,c har(10),'b')

    I don't find any differences
    This may help out for you. read here

    Comment

    • azimmer
      Recognized Expert New Member
      • Jul 2007
      • 200

      #3
      Originally posted by qhjghz
      Hi all,
      I have read about the REPLACE function and it seems alright. But, can anyone tell me what the following piece of code does?

      select @a='DebasisDas'
      select @a=REPLACE(@a,c har(10),'b')

      I don't find any differences
      It would replace LineFeeds to 'b' but as there are none in the string it simply returns it unchanged. Try this and you'll see changes:
      Code:
      declare @a as varchar(20)
      select @a='DebasisDas'
      select @a
      select @a=REPLACE(@a,char(68),'b')
      select @a

      Comment

      • qhjghz
        New Member
        • Aug 2007
        • 26

        #4
        Originally posted by azimmer
        It would replace LineFeeds to 'b' but as there are none in the string it simply returns it unchanged. Try this and you'll see changes:
        Code:
        declare @a as varchar(20)
        select @a='DebasisDas'
        select @a
        select @a=REPLACE(@a,char(68),'b')
        select @a

        Thanks a lot azimmer

        Comment

        Working...