使用SQL获取TableID

查询TableID需要从SqlDictionary中查询,此表中存放了TableID和FieldID

 

alter procedure GetImageOfItemId @ItemId varchar(20)
as
begin
select top 1 a.itemId,
    b.ACT_DesignNo,
    d.image,
    c.RefTableId
from inventTable a
    join ACT_DesignNoTable b on a.ACT_DesignNo = b.ACT_DesignNo
    join DocuRef c on c.RefRecId = b.RecId
    join DocuImgs d on d.RefRecId = c.RecId
where c.RefTableId in (    select tableid
                        from SqlDictionary
                        where fieldId = 0 and
                            name = 'Act_DesignNoTable'
                        )
    and a.itemid = @ItemId
end
go

posted @ 2012-03-06 09:16  perock  阅读(1244)  评论(0编辑  收藏  举报