Solved

SQL Split output

Posted on 2016-10-25
2
52 Views
Last Modified: 2016-10-25
Hi I have a column in Microsoft SQL 2008 that it data is delimited by a "."   every column has it and only one delimiter

so I have  something like this

RecordID ,  TableFieldName
-------------   -----------------------------------
1                 Profile.Firstname
2                 Profile.LastName
3                 Contact.PhoneNumber

I would want to have output like this

Record    Table            Field
----------    -------------    ----------------------
1              Profile          FirstName
2              Profile          LastName
3              Contact        PhoneNumber
0
Comment
Question by:Charles Baldo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 500 total points
ID: 41859075
SELECT
    RecordID,
    LEFT(TableFieldName, CHARINDEX('.', TableFieldName) - 1) AS Table,
    SUBSTRING(TableFieldName, CHARINDEX('.', TableFieldName) + 1, 200) AS Field
FROM table_name
0
 

Author Closing Comment

by:Charles Baldo
ID: 41859197
Perfect Thank you
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how the fundamental information of how to create a table.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question