Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7875361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:58:11+00:00 2026-06-03T02:58:11+00:00

I have a column name called Username in my table in SQL Server 2008.

  • 0

I have a column name called Username in my table in SQL Server 2008.
Username has following data

Username
corp\abc
corp\petern
corp\timw

and so on

I need my Username to be

Username
abc
petern
timw

how do I parse the data in Username to skip corp\ ?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:58:13+00:00Added an answer on June 3, 2026 at 2:58 am

    You could use PARSENAME to split the data but the function uses dot (.) as the delimiter. So, you have to first replace the backward slashes (\) with period or dot (.).

    Click here to view the demo in SQL Fiddle.

    Script:

    CREATE TABLE users
    ( 
        username VARCHAR(30) NOT NULL
    );
    
    INSERT INTO users (username) VALUES
         ('corp\abc'),
         ('corp\corporate\'),
         ('corp\yescorp'),
         ('corp\def'),
         ('\corpabc\'),
         ('corpabc\');
    
    SELECT  username
        ,   PARSENAME(REPLACE(username, '\', '.'), 1) AS usernameonly
    FROM    users;
    

    Output:

    USERNAME            USERNAMEONLY
    -----------------   ------------
    corp\abc            abc
    corp\corporate\ 
    corp\yescorp        yescorp
    corp\def            def
    \corpabc\   
    corpabc\    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

MS SQL Server 2000 I have a column in Table A called Name. I
I have table name called Person with following column names P_Id(int), LastName(varchar), FirstName (varchar).
I have a table called customer which has, among others, a column called name
I have the following table in SQL Server 2000: TABLE_NAME | COLUMN_NAME | TYPE_NAME
I have a table in Rails with just one column called :name . When
I have a table called hl7_lock in SQL Server with these columns: hl7_id lock_dtm
I have a table with a column name called index select id, index from
In mysql database i have this column called: Name: Date Type: datetime I have
I have a datagrid called DataGridView1, column A contains a name, column B contains
I have datatable with column name tag and 100 rows of data.I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.