How to parse HL7 delimiters using only MS SQL Syntax

我们两清 提交于 2019-12-04 22:07:27

The code on the post should parse through the HL7 Message delimiters of | and ^, if you want to parse through the ~ delimiter, then you will need to add another cursor for it.

Here's the end result of what it should look like:

Row   filename         RecordType Value    id Subvalue  id2  RecordTypeID                                 
------------------------------------------------------------------
1     HL7_filename.dat    MSH      MSH      0   MSH     0       1
2     HL7_filename.dat    MSH      ^~\&     1           0       1
3     HL7_filename.dat    MSH      ^~\&     1   ^~\&    1       1
4     HL7_filename.dat    MSH     EIH7      2   EIH7    0       1

From here on, you can map the subvalue data based on the "RecordType", "id" and "id2" to your corresponding tables. RecordTypeID counter is used if the same segment was sent more than once in one file.

Hopefully this will be a help to some who are stuck

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!