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 180403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:34:50+00:00 2026-05-11T14:34:50+00:00

I have the following SQL script: DECLARE @temp table ( ID int IDENTITY(1, 1),

  • 0

I have the following SQL script:

DECLARE @temp table (     ID int IDENTITY(1, 1),     data nvarchar(100) )  INSERT INTO @temp (data) VALUES ('a,b,c') INSERT INTO @temp (data) VALUES ('d,e,f')  SELECT * FROM @temp AS T     INNER JOIN         (SELECT *         FROM dbo.__StringSplit(T.data, ',', T.ID)) AS S     ON T.ID = S.RefID 

And on after clicking !Execute, I got these:

Line 17 The multi-part identifier 'T.data' could not be bound. 

I have also tried the non-join version and got the same error:

SELECT T.ID, S.Item AS dataItem FROM @temp AS T, dbo.__StringSplit(T.data, ',', T.ID) AS S WHERE T.ID = S.RefID 

…

What I expected was that I should gets a table with IDs coming from @test.ID and each comma-separated values in @test.data gets split up into its own records and its value put into the dataItem field.

How can I accomplish that?
Am I required to use cursors?

I’ve pasted the dbo.__StringSplit table-valued-function implementation at http://pastebin.com/f7dd6350f

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. 2026-05-11T14:34:50+00:00Added an answer on May 11, 2026 at 2:34 pm

    In SQL2000 you need cursors. In SQL2005/2008, you can use CROSS APPLY satement; probably like next (can’t test just now):

    SELECT T.ID, S.Item AS dataItem FROM @temp AS T CROSS APPLY dbo.__StringSplit(T.data, ',', T.ID) AS S 

    EDIT – I found this page on CROSS APPLY and then came up with:

    SELECT T.ID, S.Item AS dataItem FROM @temp AS T     CROSS APPLY     dbo.__StringSplit(T.data, ',', T.ID) AS S WHERE T.ID = S.RefID 

    Which solved my problem 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 153k
  • Answers 153k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You are getting a text/html content type back as a… May 12, 2026 at 10:20 am
  • Editorial Team
    Editorial Team added an answer It sounds like your needs would be better met with… May 12, 2026 at 10:20 am
  • Editorial Team
    Editorial Team added an answer You can try increasing the z-index value of the menu. May 12, 2026 at 10:20 am

Related Questions

I have the following query which is working fine, but I also want to
I'm using SQL*Plus 9.2 on Oracle 10g enterprise. I have created some scripts that
System Specifications Microsoft SQL Server Management Studio 9.00.4035.00 Microsoft Analysis Services Client Tools 2005.090.4035.00
Right... this one had me baffled for a while today so maybe one of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.