方式一: --select @p_AllPARTOFCHECK = (select CAST(t.PARTOFCHECK as varchar)+'|' from QUEUEDETAIL t where t.APPOINTSID = @p_APPOINTSID for xml path('') ) --select @p_AllDirection = (select CAST(t.DIRECTION as varchar)+'|' from QUEUEDETAIL t where t.APPOINTSID = @p_APPOINTSID for xml path('') ) 拼接结构如:字符串A|字符串B| 方式二: select @p_AllPARTOFCHECK = (stuff((select '|' + PARTOFCHECK from QUEUEDETAIL where appointsid = @p_APPOINTSID for xml path('')),1,1,'')) select @p_AllDirection = (stuff((select '|' + direction from QUEUEDETAIL where appointsid = @p_APPOINTSID for xml path('')),1,1,'')) 拼接结构如:字符串A|字符串B 注:具体拼接分割符,可自行定义使用,示例中使用 | 进行拼接 --截取 select SUBSTRING(t.AGE,1,CHARINDEX('岁',t.AGE,2)) as age ,t. * from VIEW_PRINT t where CHARINDEX('岁',t.AGE,2) >-1 select SUBSTRING(t.TIMEPART,0,CHARINDEX('~',t.TIMEPART)) as BEGINTIME ,t. * from [TableQueueDetail] t
博客内容主要用于日常学习记录,内容比较随意,如有问题,还需谅解!!!