HI,
I am using following script to find out the number of row in all the
table of a database is there any simple way out? if so pls mail me
declare @.TAB VARCHAR (20),
@.qu nvarchar (100)
DECLARE TABALE CURSOR FOR
select name from sysobjects where xtype='u' order by name open tabale
FETCH NEXT FROM TABALE INTO @.TAB while @.@.fetch_status = 0 begin --SET
@.TAB = 'SALES1'
--select name from sysobjects where name = @.tab SET @.QU ='SELECT
COUNT(*) FROM '+@.TAB print @.tab EXEC sp_executesql @.QU fetch next from
TABALE INTO @.TAB end close tabale deallocate tabale
Thanks
Sajid ChhapekarYOu could use the undocumented procedure sp_msforeachtable, but keep in
mind that this one is undocumented and might be deprecated in further
versions of SQL Server.
sp_msforeachtable 'SELECT ''?'' as TableName COUNT(*) AS Counted_rows
FROM ?'
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--sql
Showing posts with label tab. Show all posts
Showing posts with label tab. Show all posts
Monday, March 26, 2012
Monday, March 12, 2012
Script Formatting Options.
In SQL Server 2000 there is a Script Tab on the Options. This allows you to turn off delimiters "[", remove collation ...... as defaults.
Where is this funtionallity in 2005?
Thanks,Belatedly moving this thread to the Tools forum.
Script Formatting Options.
In SQL Server 2000 there is a Script Tab on the Options. This allows you to turn off delimiters "[", remove collation ...... as defaults.
Where is this funtionallity in 2005?
Thanks,Belatedly moving this thread to the Tools forum.
Subscribe to:
Posts (Atom)