问题描述
我在这个问题上遇到了困难.我有一个表,其中包含一列包含nvarchar(MAX)字符串文本的表,该表由管道(|)分隔.文本字符串中变量的数量不是静态的.因此,我要执行的操作是以下任一操作:
1.将管道处的字符串拆分为字符串中遇到的每个管道为多行.
或者,
2.将管道处的字符串拆分为字符串中遇到的每个管道的多列.
有任何想法吗?字符串的示例如下:
熟练的护理观察+ DOE,JANE的爱德华(1234),2016年1月2日由D. DUCK(RN)收集(完整)|生命体征/I& O/血液葡萄糖... [温度]温度:96.3 ... VS温度路径:腋窝... [心率]径向心率:82 ... VS HR心尖搏动律:常规... VS HR心尖搏动性格:正常... [BP]收缩压:112 ...舒张压BP:78 ... [呼吸]呼吸:18 ... VS脉搏氧气来源:室内空气... [踏板脉搏] VS踏板R脉搏(+):+ 2-正常.. .VS踏板L脉搏(+):+ 2-正常||心血管... [水肿]心血管水肿:无... [循环检查]循环检查WNL ... [毛细血管补充]毛细血管补充(秒):3sec ||呼吸... [呼吸音左肺]呼吸音左肺透明... [呼吸音右肺]呼吸音右肺透明... [呼吸特性]呼吸特性正常|| PAIN ... [疼痛]疼痛部位:无疼痛||精神状态/认知... [当前的心理状态tus]心理状态LOC当前警报... [方向]心理状态方向:x 2 ... [通信]心理状态通信口语||膀胱... [膀胱]尿液澄清/黄色...尿液投诉无.. .[失禁]尿失禁失禁|| GASTROINTESTINAL ... [胃肠道]胃肠道肠鸣音出现x 4 ...胃肠道直肠出血:无... [肠大便失禁]胃肠道大便失禁... [末次BM日期]上次BM日期:2016/01/22 ... [凳颜色]胃肠凳C颜色:WNL ||神经病学... [神经病学]居民的神经病学WNL ... [小学生] EENT PERRLA ||皮肤... [皮肤]完整的皮肤...正常皮肤的皮肤... [皮肤问题]皮肤问题没有皮肤问题...皮肤问题粘液膜:湿润...皮肤问题预防措施到位:是... [床垫/垫子] ]皮肤压力再分配床垫||营养/肠溶... [营养]营养方面没有问题...口渴的营养投诉:否... [饮食类型]营养机械软肉... [液体]营养液稀液体||情绪和行为/精神/精神... ... [情绪]情绪/行为情绪愉悦... [心理/精神]情绪/行为心理精神需求得到满足| |功能... [功能]功能性步态不稳定...功能差的平衡:是...功能疗法PT ...功能疗法OT ...功能疗法ST ... [活动性]功能活动性:由主席决定...功能性活动偏好:小组活动... [位置]功能性位置:转弯时间表... [设备]功能辅助设备轮椅||日常活动(ADL)... [ADL]床活动性绩效:广泛的帮助...提供床移动性支持:一个人的身体帮助...转移自我表现:广泛的帮助...转移性的自我提供:一个人的身体帮助...走进房间自我表现:完全依赖. ..走进房间提供的支持:1人的身体协助...走在走廊上自我表现:完全依赖...走在走廊上提供的支持:一个人的身体辅助...在单位上的运动自律:在整个单位上的运动...提供的单位上的运动:一个人的身体辅助...单位运动:自我表现:完全依赖...单位运动:提供自我支持:一个人的身体帮助...穿戴自我表现:完全依赖...所提供的敷料支持:一个人的身体帮助...饮食自我表现:广泛帮助...饮食支持:一个人的身体帮助...上厕所使用自我表现:完全依赖...厕所使用的支持情况:一个人身体护理...个人卫生自我表现:总计依赖性...提供个人卫生支持:一个人的身体帮助...洗澡自我表现:完全依赖...洗澡依赖性提供:一个人的身体帮助... [过渡和行走期间的平衡]达到站立平稳,只能在人员协助下稳定...步行(如果使用辅助装置,则使用):不稳定,只能在人员协助下稳定...转身:不稳定,只能在人员协助下稳定...上厕所和下厕所:不稳定,只能在工作人员协助下稳定...表面到表面的转移:不稳定,只能在工作人员协助下稳定||安全... [侧栏/床]安全侧栏/床低床... [呼叫灯]到达时的安全呼叫灯... [注]安全说明:坠落预防措施||特殊护理... [隔离注意事项]特殊护理隔离注意事项标准... [临终关怀]特殊护理临终关怀
我尝试过的事情:
尝试查看拆分函数,但看不到它适用于动态长度.
I am having a difficult time with this subject. I have a table that contains a column with nvarchar(MAX) string text in it which is separated by the Pipe (|). The number of variable in the text string is not static. So what I am looking to do is either one of the following:
1. Split the string at the Pipe, into multiple rows for each Pipe encountered in the string.
Or,
2. Split the string at the Pipe, into multiple columns for each Pipe encountered in the string.
Any Ideas? A sample of the string is as follows:
SKILLED NURSING OBSERVATIONS + ADL OF DOE, JANE (1234) COLLECTED 1/22/2016 14:26:58 BY D. DUCK (RN) (COMPLETE)|VITAL SIGNS/I&O/BLOOD GLUCOSE ... [Temperature] Temperature: 96.3 ... VS Temperature Route: Axillary ... [Heart Rate] Radial Heart Rate: 82 ... VS HR Apical Pulse Rhythm: Regular ... VS HR Radial Pulse Character: Normal ... [BP] Systolic BP: 112 ... Diastolic BP: 78 ... [Respiratory] Respirations: 18 ... VS Pulse Ox Oxygen Source: Room Air ... [Pedal Pulses] VS Pedal R Pulse (+): +2- Normal ... VS Pedal L Pulse (+): +2- Normal ||CARDIOVASCULAR ... [Edema] Cardiovascular Edema: None ... [Circulation Checks] Circulation Checks WNL ... [Capillary Refill] Capillary Refill (Seconds): 3sec ||RESPIRATORY ... [Breath Sounds Left Lung] Breath Sounds Left Lung Clear ... [Breath Sounds Right Lung] Breath Sounds Right Lung Clear ... [Respiratory Character] Respiratory Character Regular ||PAIN ... [Pain] Pain Location: No Pain ||MENTAL STATUS / COGNITION ... [Current Mental Status] Mental Status LOC Current Alert ... [Orientation] Mental Status Orientation: x 2 ... [Communication] Mental Status Communication Verbal ||BLADDER ... [Bladder] Urine Clear/Yellow ... Urinary Complaints None ... [Continence] Urinary Continence Incontinence ||GASTROINTESTINAL ... [Gastrointestinal] GI Bowel Sounds Present x 4 ... Gastrointestinal Rectal Bleeding: None ... [Bowel Continence] GI Bowel Continence Incontinent ... [Date of Last BM] Date of Last BM: 01/22/2016 ... [Stool Color] Gastrointestinal Stool C Color: WNL ||NEUROLOGIC ... [Neurologic] Neurologic WNL for Resident ... [Pupils] EENT PERRLA ||SKIN ... [Skin] Skin Intact ... Skin Normal Turgor ... [Skin Issues] Skin Issues No Skin Issues ... Skin Issues Mucous Membranes: Moist ... Skin Issues Prevention Measures In Place: Yes ... [Mattress/Cushion] Skin Pressure Redistribution Mattress ||NUTRITION/ENTERAL ... [Nutrition] Nutritional No Problems Noted ... Nutrition Complains of Thirst: No ... [Diet Type] Nutrition Mechanical Soft Meats ... [Liquids] Nutrition Liquids Thin Liquids ||MOOD AND BEHAVIOR/PSYCHO/SPIRITUAL ... [Mood] Mood/Behavior Mood Pleaseant ... [Psycho/Spiritual] Mood/Behavior Psychospiritual Needs are met ||FUNCTIONAL ... [Functional] Functional Gait Unsteady ... Functional Poor Balance: Yes ... Functional Therapy PT ... Functional Therapy OT ... Functional Therapy ST ... [Mobility] Functional Mobility Activity: Up to Chair ... Functional Mobility Activity Preference: Group Activity ... [Positioning] Functional Positioning: Turn Schedule ... [Devices] Functional Assistive Device Wheelchair ||ACTIVITIES OF DAILY LIVING (ADL) ... [ADLs] Bed Mobility Self-Performance: Extensive assistance ... Bed Mobility Support Provided: One person physical assist ... Transfer Self-Performance: Extensive assistance ... Transfer Support Provided: One person physical assist ... Walk in room Self-Performance: Total dependence ... Walk in room Support Provided: One person physical assist ... Walk in corridor Self-Performance: Total dependence ... Walk in corridor Support Provided: One person physical assist ... Locomotion on unit Self-Performance: Total dependence ... Locomotion on unit Support Provided: One person physical assist ... Locomotion off unit Self-Performance: Total dependence ... Locomotion off unit Support Provided: One person physical assist ... Dressing Self-Performance: Total dependence ... Dressing Support Provided: One person physical assist ... Eating Self-Performance: Extensive assistance ... Eating Support Provided: One person physical assist ... Toilet use Self-Performance: Total dependence ... Toilet use Support Provided: One person physical assist ... Personal hygiene Self-Performance: Total dependence ... Personal hygiene Support Provided: One person physical assist ... Bathing Self-Performance: Total dependence ... Bathing Support Provided: One person physical assist ... [Balance During Transitions and Walking] Moving from seated to standing steady, only able to stabilize with staff assistance ... Walking (with assistive device if used): Not steady, only able to stabilize with staff assistance ... Turning around: Not steady, only able to stabilize with staff assistance ... Moving on and off toilet: Not steady, only able to stabilize with staff assistance ... Surface-to-surface transfer: Not steady, only able to stabilize with staff assistance ||SAFETY ... [Siderails/Bed] Safety Siderails/Bed Low Bed ... [Call Light] Safety Call Light in Reach ... [Notes] Safety Notes: fall precaution ||SPECIAL CARE ... [Isolation Precautions] Special Care Isolation Precautions Standard ... [Hospice] Special Care Hospice
What I have tried:
Have tried looking at Split Functions but don''t see where it applies to dynamic length.
推荐答案
这篇关于如何在SQL 2012中分割长字符串管道分隔的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!