• Sean Lange (10/25/2013)


    p.shabbir (10/25/2013)


    Hi Scuby,

    Try this.

    select REPLACE(SUBSTRING(Your_Column,1,CHARINDEX('@',Your_Column)),'@','') Name from Your_Table NOLOCK

    Thanks

    sibi.

    Why NOLOCK???

    Sean,

    At my work i used to specify "NOLOCK" at the end of select statement.Hence, by habit i mentioned there.You can take out that.

    And i checked your query.

    Only this is statement is working.

    REPLACE(SUBSTRING(SEmail_Addr,1,CHARINDEX('@',SEmail_Addr)),'@','').

    For other two got this error.

    Error : Invalid length parameter passed to the LEFT or SUBSTRING function.