SQL Server Stored Procedure

  • hello all

    can anyone tell me how to write a stored procedure to find out newline char in a specific field in a table of sql server database and eliminate this.

  • Try this ..... char(10) - Line Feed / char(13) - CR

    SET NOCOUNT ON

    go

    drop table #NEWLINE

    go

    create table #NEWLINE (Field1 int identity(1,1), Field2 varchar(30))

    go

    insert #NEWLINE select '1111

    11111'        

    go

    select * from #NEWLINE

    go

    update nl

    set nl.Field2 = replace(nl.Field2,char(13), ' ')

    FROM #NEWLINE nl

    update nl

    set nl.Field2 = replace(nl.Field2,char(10), ' ')

    FROM #NEWLINE nl

    go

    select * from #NEWLINE

     

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply