SQL Server Performance

Query Help

Discussion in 'General DBA Questions' started by k_ashish2002, Nov 29, 2006.

  1. k_ashish2002 New Member


    Need a query help.
    I have a table in which a column is having the mailid like abc@xyz.com. Now I want to extract the name of all records in mailid column. Suggest some query so that my result should have the all data before of '@' symbol.

    Ashish Kuriyal
  2. ranjitjain New Member

    try this:

    declare @t1 table(col1 varchar(50))
    insert @t1
    select 'abc@xyz.com' union all
    select 'sql.query@2000.com'

    select left(col1,charindex('@',col1)-1) from @t1
  3. k_ashish2002 New Member

    Thaks a lot Ranjit.

    Ashish Kuriyal

Share This Page