Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

SQL Server 2012 - Inserting multiple records from one block of text

Language: Layout:
View schema
Execution time: 0,03 sec, rows selected: 6, rows affected: 4, absolute service time: 0,17 sec 
fork mode |  history
   id created
1 1 06.04.2017 15:16:59
   id noteId noteLineNumber noteLineText
1 1 1 1 On SQL server 2012. I have normalized tables that will consist of "notes". Each "note" record can have many notelines tied to it with a foreign key. I'm looking for a SQL statement that will parse a block of text and, for each line within that text, insert a separate record.
2 2 1 2 I'm guessing some sort of "WHILE loop" for each block of text but can't get my head around how it would work.
3 3 1 3 To be clear: The end result of this would be to just paste the block of text into the query and execute so that I can get each individual line of it into the note without messing around creating multiple insert statements.

    
                
λ
.NET NoSQL database for rapid development