Thank you.
I got correct query.
-------------------------
declare @vcTemp int
declare @sql nvarchar(max)
declare @tblname1 as varchar(50)
declare @tblname2 as varchar(50)
set @tblname1='tbl_00001'
set @tblname2='tblSt_00001'
SELECT @sql='select @vcTemp=count(*) from(
select line,Status_text,Zerox_ID from...