[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

stored procedure to split and loop

Posted on 2011-10-04
1
Medium Priority
?
378 Views
Last Modified: 2012-05-12
I need help in writing logic in stored procedure, to inser into TABLEA.
in the SQL stored procedure,
i have string ( that is @FeildInfo ) with

value1|Value2#value3|Value4#value5|value6 etc....

i want to split the above string ( @feildInfo) into  indivual values so that i can insert into table like,

valu1 should go to colum 'n' in the TABLEA
value2 should go to column 'P' in TABLEA

as one record.


value3 should go to column 'n' in the TABLEA,
value4 should go ro column 'p' in the TABELA
etc..

basically, i need to do
please help on this
i am using SQLSERVER2008

thanks,
Ram
0
Comment
Question by:ram27
1 Comment
 
LVL 23

Accepted Solution

by:
wdosanjos earned 2000 total points
ID: 36912307
Please check the following Solution.  I believe you can leverage the function provided.

SQL Parse string
http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL_Server_2008/Q_27145400.html#a36055426

I hope it helps.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Suggested Courses

873 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