Click here to Skip to main content
15,914,447 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi. I am creating a console application in C#, I need to increase the speed of it and I am converting some of the code to a stored procedure in Ms SQL 2014. I am creating a list with all of the values that need to be in the table. I see that there is a split function that I could split on the commas, but that only seems useful for a table with a single column. My table needs to have at least 5 columns(SSN, Account Number, Earnings, FirstName, LastName). My string looks like this. ( 432-45-4545, 23456, $34,000, George, Bush, 444-00-6565,45633, $25,000, Bill, Clinton......) I need this table(temp) to use it to query a permanent table for values matching SSN.
The string will also be of dynamic length. Might need table to be 5 thousand rows or 20 thousand. I have some basic knowledge of MS Sql but this way is above my head and I can't find a example anywhere. I am mainly a perl, c++ and c# programmer not a database person.
Posted
Comments
Richard Deeming 3-Sep-15 14:58pm    
Are you looking for Table-Valued Parameters?
Table-Valued Parameters[^]
Use Table-Valued Parameters (Database Engine)[^]
PIEBALDconsult 3-Sep-15 15:10pm    
bcp
https://msdn.microsoft.com/en-us/library/ms162802(v=sql.120).aspx
Maciej Los 3-Sep-15 15:16pm    
Is there any piece of code you're using?
OleDb is that what you're looking for!

1 solution

you need to do multiple split

and i have explained it clearly in this article please have a look at this

http://www.streetrat.in/Articles/Content/Iterate-a-string-and-do-various-operations-and-convert-a-string-into-a-Datatable114.aspx?RatHistory=114[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900