Scripts

Technical Article

T-SQL to Export Table Structure to a script

When you want to export a table structure to T-SQL, everyone always points you to Enterprise Manager, or a script that calls BCP.Sometimes, a developer either doesn't have access to those tools, or just doesn't want to use them (like me) out of spite.I made this T-SQL because it was educational, and noone else seems […]

3 (2)

You rated this post out of 5. Change rating

2003-03-26

4,002 reads

Technical Article

DB Reindex all Databases

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.

You rated this post out of 5. Change rating

2003-03-23

1,939 reads

Technical Article

Jscript to obscure emails from robots in HTML

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 […]

You rated this post out of 5. Change rating

2003-03-23

95 reads

Technical Article

Convert Interger to Binary String for Bit Masks

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 […]

5 (1)

You rated this post out of 5. Change rating

2003-03-21

3,829 reads

Technical Article

Statistic of SQL-Server - Daily Version

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 […]

You rated this post out of 5. Change rating

2003-03-13

1,046 reads

Technical Article

Weekly Reports Made Easy

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', […]

You rated this post out of 5. Change rating

2003-03-13

307 reads

Technical Article

Load Backup History from Backup File

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. 

You rated this post out of 5. Change rating

2003-03-11

301 reads

Technical Article

Script to validate user input for password change

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.

You rated this post out of 5. Change rating

2003-03-11

755 reads

Blogs

A New Word: Ochisia

By

ochisia – n. the fear that the role you once occupied in someone’s life...

Create a Numbers Table in Power Query

By

This is a quick blog post, mainly so I have the code available if...

Microsoft finally adds Tenant Switcher for Fabric / Power BI

By

Praise whatever deity you believe in, because it’s finally here, a tenant switcher for...

Read the latest Blogs

Forums

To View or not to View, that is the question...

By pietlinden

I've read lots of the horror stories about nested views in databases where they're...

Grant user read-write permission to a single database

By PJ_SQL

Hello! How do I grant a user to read-write to a single database and...

Table Delete

By Bruin

I have a very large table and I'm looking to do a cleanup based...

Visit the forum

Question of the Day

The Density Vector

When building statistics, there is the concept of density that refers to the duplicates in a table. How is this calculated?

See possible answers