Hello every one.
According to microsoft the following script should work in 6.5
The following script will return the name and the number of rows in every user-defined table in a given database:
USE pubs -- replace pubs with your database name
SET NOCOUNT ON
DECLARE tables_cursor CURSOR
FOR
SELECT name FROM sysobjects WHERE type = 'U'
OPEN tables_cursor
DECLARE @tablename varchar(30), @quote char(1)
SELECT @quote = ""
FETCH NEXT FROM tables_cursor INTO @tablename
WHILE (@@fetch_status <> -1)
BEGIN
EXEC ('Select ' + @quote+'Rows in ' + @tablename + ' = '+
@quote + ', count(*) from '+ @tablename)
FETCH NEXT FROM tables_cursor INTO @tablename
END
DEALLOCATE tables_cursor
SET NOCOUNT OFF
But I'm getting error where the key work "in" is used.
Could you provide some help.
Thanks much.
ps. have to run this on 6.5
According to microsoft the following script should work in 6.5
The following script will return the name and the number of rows in every user-defined table in a given database:
USE pubs -- replace pubs with your database name
SET NOCOUNT ON
DECLARE tables_cursor CURSOR
FOR
SELECT name FROM sysobjects WHERE type = 'U'
OPEN tables_cursor
DECLARE @tablename varchar(30), @quote char(1)
SELECT @quote = ""
FETCH NEXT FROM tables_cursor INTO @tablename
WHILE (@@fetch_status <> -1)
BEGIN
EXEC ('Select ' + @quote+'Rows in ' + @tablename + ' = '+
@quote + ', count(*) from '+ @tablename)
FETCH NEXT FROM tables_cursor INTO @tablename
END
DEALLOCATE tables_cursor
SET NOCOUNT OFF
But I'm getting error where the key work "in" is used.
Could you provide some help.
Thanks much.
ps. have to run this on 6.5