Home Forums SQL Server 7,2000 T-SQL SUBSTRING And CHARINDEX to find start/end of string RE: SUBSTRING And CHARINDEX to find start/end of string

  • bitbucket-25253 (9/30/2012)


    Is this what you want / need ?

    SELECT SUBSTRING(@x,28+CHARINDEX ('CustomerFornm: Changed from ',@x),CHARINDEX('CustomerDOB',@X,1)-77) AS 'Is this really what you

    want?'

    Result:

    Is this really what you want?

    Harry to Ben

    Actually little correction in Ron's script.

    SELECT SUBSTRING(@var,28+CHARINDEX ('CustomerFornm: Changed from ',@var),CHARINDEX('CustomerDOB',@var)- CHARINDEX ('CustomerFornm: Changed from ',@var)-28) AS 'Is this really what you

    want?'

    --rhythmk
    ------------------------------------------------------------------
    To post your question use below link

    https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
    🙂