DECLARE curCur
READ_ONLY
FOR select name from sys.objects where type='U' and name like 'StknWIP%' order by name
declare @strsql nvarchar(300)
declare @objname varchar(40)
OPEN curCur
SET NOCOUNT ON
FETCH NEXT FROM curCur INTO @objname
WHILE (@@fetch_status =0)
BEGIN
set @strsql='select count(*) from '+@objname
-- PRINT 'add user defined code here'
-- eg.
PRINT @strsql
EXECUTE sp_executesql @strsql
FETCH NEXT FROM curCur INTO @objname
END
CLOSE curCur
DEALLOCATE curCur
SET NOCOUNT OFF
GO
沒有留言:
張貼留言