I wanted to know which tables contains the most populated records in db. So I wrote this script.
2004-10-01 (first published: 2002-06-20)
15,387 reads
Patrick,
2005-01-02 (first published: 2004-11-18)
I wanted to know which tables contains the most populated records in db. So I wrote this script.
if exists(select * from tempdb.dbo.sysobjects where name like '#tmptablename%') drop table #tmptablename go select table_name into #tmptablename from information_schema.tables where table_type = 'BASE TABLE' and table_name <> 'dtproperties' alter table #tmptablename add nrowcount int go declare @cur_table nvarchar(50),@myquery nvarchar(500) declare db_cursor cursor for select table_name from #tmptablename open db_cursor fetch next from db_cursor into @cur_table while @@fetch_status = 0 begin set @myquery = 'update #tmptablename set nrowcount = (select count(*) from ['+@cur_table+'] with (nolock) ) where table_name = '''+@cur_table+'''' print @myquery execute sp_executesql @myquery fetch next from db_cursor into @cur_table end CLOSE db_cursor DEALLOCATE db_cursor select * from #tmptablename order by nrowcount desc
I have always read that 8060 bytes is the maximum size. This is stated over and over again in Books Online, the MS site and numerous other sites, including this one. However a post in our forum recently questioned this. I decided to verify the problem and do a little research.
The User_Defined_Functions.exe file contains the User-Defined Functions white paper. The User-Defined functions white paper outlines the characteristics of the new user-defined function (UDF) feature that is introduced in Microsoft SQL Server 2000. The white paper also summarizes how you can create your own Transact-SQL functions to extend the programmability of Transact-SQL.
The following stored procedure will demonstrate the use of cursor metadata. Using cursor metadata we can get information about an SQL statement and use that information to dynamically generate other code such as HTML or other stored procedures.
ne of the issues you face when building Web applications is handling the errors you encounter when interacting with a back-end database. I was recently working with someone to create a new Web site with SQL Server™, ActiveX® Data Objects (ADO), and ASP. Lots of little things came up that I thought were worth sharing with MIND readers, so I'll focus this column on what I learned from this experience and the solutions to many of the problems I faced.
2001-07-13
1,579 reads