我在存储过程中有以下代码:
select
i.ItemID
,cast(p.PropertyValue as varchar(100)) as Custodian
,cast(null as int) as PersonID
,cast(null as bit) as Child
into #c
from tblItem as I
inner join tblExternalData_Matches as m on I.ItemID = m.ItemID
inner join tblItemExtendedProperties as p on I.ItemID = p.ItemID and p.[Application] = 'Import' and p.PropertyName = 'File Owner'
where m.SourceID = @SourceID
--Update PersonID for custodians we already have
update c set
c.PersonID = p.PersonID
from #c as c
inner join tblPerson as p on c.custodian = p.NameDisplay
转换它的内存效率最高的方法是什么? 我应该只选择数据类型的结果?
答案 0 :(得分:0)
DataTable不是最常用的内存类型,但它取决于您将对数据执行的操作。
查看DataReader,了解处理记录集的最有效方法。
这是一个很棒的blog entry,可以比较DataSet和DataReaders,并帮助您决定走哪条路。