Posts

Showing posts from April, 2010

HOWTO: Find out the Sizes of All the User Tables in a Database in SQL

Do you need to know the sizes for all the user tables in your database? I found this script by Mitchel Sellers, an SQL Server MVP ,  to be very handy. I've modified it slightly, but you can get the original on his blog . Thank you Mitchel for allowing me to post this here. Please excuse the poor formatting, I am working on finding and implementing a decent code formatted for both SQL and C#. SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author:            Mitchel Sellers - mitchel.sellers@gmail.com -- Create date: 2007/06/27 -- Description: Obtains spaced used data for --                            ALL user tables in the database. --                            This does not update the space --                            usage information - implicity --                            running DBCC UPDATEUSAGE on the --                            database - as recalculation has --                            

HOWTO: Generate a Random String of Characters in SQL

Here's a stored procedure to generate a string of random characters. This is useful when, for example, one needs to generate a random password. Please excuse the poor formatting, I am working on finding and implementing a decent code formatted for both SQL and C#. Thanks to  Raymond Lewallen  over at CodeBetter.com SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author:            Raymond Lewallen --                    http://codebetter.com/blogs/raymond.lewallen/archive/2005/05/17/63281.aspx -- Create date: 2005/05/16 -- Description: Generate a random string of --                            given length. --                        : Everything is self-explanatory. --                        : Right now max length is set to --                            100. So anything between 1 and --                            100 will work for a length. --                        : If you specify a --