Declare @trans table(eTransid varchar(30) Not NULL)
INSERT INTO @trans
SELECT DISTINCT eTransID
FROM csi_eRecording.dbo.eRecordAudit WITH(NOLOCK)
WHERE EventMessage LIKE 'Recorded file cannot be found%'
ORDER BY eTransID
SELECT a.*
FROM csi_eRecording.dbo.eRecordTrans a WITH(NOLOCK) INNER JOIN @trans b ON a.eTransID=b.eTransID
ORDER BY eTransID
问问题
106 次
2 回答
1
@@ROWCOUNT
tracks the last count of affected rows
declare @trans table(eTransid varchar(30) Not NULL)
insert @trans values ('all'),('hail'),('cthulhu')
select 'inserted rows=', @@ROWCOUNT
--(No column name) (No column name)
--inserted rows= 3
select * from @trans
--eTransid
--all
--hail
--cthulhu
select 'selected rows=', @@ROWCOUNT
--(No column name) (No column name)
--selected rows= 3
于 2013-04-26T15:07:38.840 回答
0
SELECT a.*,(select count(*) FROM csi_eRecording.dbo.eRecordTrans a WITH(NOLOCK) INNER JOIN @trans b ON a.eTransID=b.eTransID ORDER BY eTransID) as countIT FROM csi_eRecording.dbo.eRecordTrans a WITH(NOLOCK) INNER JOIN @trans b ON a.eTransID=b.eTransID ORDER BY eTransID
于 2013-04-26T14:40:16.110 回答