表单中有很多picklist字段 不想写链接stringmap
代码:
实体ID查询方法:
SELECT ObjectTypeCode from Entity where name='实体名称'
调用函数方法:
select dbo.getpicklist('字段名称',字段值,实体ID)
--@AttributeName 字段名称
--@AttributeValue 字段值
--@EntityName 实体名称
create function GetPickList(
@AttributeName varchar(100),
@AttributeValue int,
@EntityName varchar(100)
)
returns varchar(100)
as
begin
declare @value varchar(100)
SELECT @value=Value FROM StringMap where AttributeName=@AttributeName AND AttributeValue=@AttributeValue and ObjectTypeCode=(SELECT ObjectTypeCode from Entity where name= @EntityName)
return @value
end