zoukankan      html  css  js  c++  java
  • sqlserver 函数里并返回一个表格数据拼接的字符串

    Create function [dbo].[GetChildWorkerExtension]
    (
         @ChildId int
    )
    returns nvarchar(100)
    as
    begin
            declare @ret nvarchar(2000)
            set @ret = ''
                select @ret = @ret+';'+(case Relationship
                        when 1 then '父亲'
                        when 2 then '母亲'
                        when 3 then '爷爷'
                        when 4 then '奶奶'
                        when 5 then '姥姥'
                        when 6 then '姥爷'
                        else '其它' end)+':'+ Phone from  GuardianInfo where ChildId=@ChildId and (Phone is not null or Phone!='')
                set @ret = case when len(@ret)>0 then stuff(@ret,1,1,'') else @ret end
            return @ret
    end

  • 相关阅读:
    The Sixth Assignment
    The fifth assigiment
    网络编程
    面向对象
    python数据类型之集合
    python数据类型之列表
    python数据类型之字符串
    python数据类型之字典
    python数据类型之元组
    常用模块
  • 原文地址:https://www.cnblogs.com/chenjt/p/4077258.html
Copyright © 2011-2022 走看看