T-SQL: Split function

351965 pts.
Tags:
SQL Server 2008
T-SQL
I'm trying to split "1, 2, 3, 4, 5, 6, 7, 8, 9, 10" into a table or table variable. Is there a function that returns each number in a row?

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    I don't think such a function exists, but you could write a stored procedure to read/split the values and insert them into a table.
    70,200 pointsBadges:
    report
  • triggermortis
    Agreed with carlosdl, SQL insert statements don't really work that way. Stored procedures with loops is definitely an option. Similar to that, my first thought comes to multi-tiered operations; I'd use a HLL (ie java) application layer to speak through a data access class to the database. With added simplicity comes added complication though.
    50 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following