Shrink Multi-File Databases
This stored procedure shrinks all database files within the current database, including the unused portion of transaction log. This procedure is especially useful for multi-file databases.
2003-03-24
208 reads
This stored procedure shrinks all database files within the current database, including the unused portion of transaction log. This procedure is especially useful for multi-file databases.
2003-03-24
208 reads
This script reindexes all tables in all databases. Execute the script with the desired fill factor and it will do the rest. There is an option to exclude databases from the reindex. This makes it easy to reindex all newly created databases. Great for the Development environment when Developers are creating database all the time.
2003-03-23
1,964 reads
This script will obscure email addresses from robots even ones that ignore the tags to not snoop. Usually robots that ignore the tags, and the robots.txt file are used by spammers. They pull down the SOURCE of your page and scrape the email addresses from them. This script breaks the mail href into its base […]
2003-03-23
100 reads
The three functions here can be used to store Bit Masks as Integers.These are functions to convert an integer into a binary string. This can be useful if you store Bit Masks in your database as integers.For example .. '00000000000011111001001001110011' to 1020531Each Bit could represent an ON or OFF value. One integer columncould be equivalent […]
2003-03-21
3,985 reads
A Procedure gather Server Statistic per day or per run this Procedure.Output: Table TBL_SERVERSTATISTICS. You can use the results to analyze SQL-Server performance problems. You can analyze what changed after install new hardware or software, add or remove Application/DB/File/Index/Table etc.Recommendations: Run a Procedure once every day.Warning: If sql-server restarted after last run a Procedurecurrent running […]
2003-03-13
1,052 reads
Each week you are required to run various reports based on table entries made during the week preceding latest Sunday. Use this SQL7/2000 procedure (can be a UDF in SQL2K) to retrieve the latest midnight of a specified day of the week as illustrated below: Declare @StartDate datetime, @EndDate datetime Exec DBAservice.dbo.uspGetLatestWkDayMidnight @pDate = '1998-05-06', […]
2003-03-13
313 reads
This script creates a stored proc to verify all backups in a media set and load their history into MSDB. I use this frequently when I get backup files from clients and want to use Enterprise Manager's intelligent restore selection to quickly get the database restored on a test machine.
2003-03-11
305 reads
For SQL Server in Mixed Authentication mode thisstored procedure helps to validate users password. Currently this procedure checks for the next requrements: password must have length at least 8 characters plus among them at least one digit and at least one of the characters must be in upper case.
2003-03-11
777 reads
Do you hate using bitwise operands? I do, a lot. I wrote the following function to try to minimize the need for using them. When testing 'status' variables in the 'sysobjects' table, for example, I decided there just had to be an easier way to see if bit 31 is set than asking if STATUS […]
2003-03-07
759 reads
Purpose: This SP is used to add a logfile and a datafile to each file group in a database or all databases. This is handy when you have a lot of databases and you want to add a new big SAN-disk and stop db expansion on the old disks.Consider: Avoid running any large updates when […]
2003-03-06
130 reads
Welcome back, my fellow sleuths, to my mystery-inspired blog series! I’m having a ton...
By Steve Jones
This was one of the original values: The facing page has this text: No...
By Chris Yates
For decades, enterprises have thought about data like plumbers think about water: you build...
Comments posted to this topic are about the item Create an HTML Report on...
Comments posted to this topic are about the item I Love Editorials
Hi everyone I have a 1000 plus line query and I am getting an...
What happens when I run this code:
DECLARE @s VARCHAR(1000) = 'apple, pear, peach' SELECT * FROM STRING_SPLIT(@s, ', ')See possible answers