Scripts

Technical Article

Script to Zip a Backup File

A handy dandy proc that can be used to zip up a backup file to location specified. Also called from a backup script to automate the compression of all backups using PKZip command line utility. Make sure pkzip is in the path and found by the shell prior to using this script.

1 (1)

You rated this post out of 5. Change rating

2001-08-20

3,716 reads

Technical Article

Script to Search SQL Error Log For a String

This script(sproc)uses xp_cmdshell from sql and FINDSTR from DOS to search the current errorlog for a specific string such as kernel or failed login. Compile this in the master db and if you do not pass an input parameter a example usage will display for you. ex: sp_dba_sqlerrorlog kernel Edward J Pochinski III

4 (1)

You rated this post out of 5. Change rating

2001-08-13

1,899 reads

Technical Article

Show Fragmentation Before and After Reindex

This will show the fragmentation and stats before and after a reindex of a specified table. Run in the context for the db that holds the table the proc will get passed and re-index. Complile in master since the master is checked first for any SP that is prefixed with SP_ and you can call […]

You rated this post out of 5. Change rating

2001-08-13

4,016 reads

Technical Article

SQL Server Current Activity SuperCheck

This gives a quick check of the current activity on a SQL Server. I developed this after getting continually frustrated with "Current Activity" in SQL/EM getting blocked by processes when I needed to see blocking issues on the server. It has been immensely valuable to me in quickly identifying production-stopping issues on the database. It […]

4.2 (5)

You rated this post out of 5. Change rating

2001-08-13

4,875 reads

Technical Article

Optimize Character Field Usage

This stored procedure was designed to scan all your character based columns in a particular database and show the minimum, maximum and average data length. As well as give an efficiency rating of the data stored. Input: None Output: Table name, Column name, Defined datatype and length, Average length of data for that column, Minimum […]

You rated this post out of 5. Change rating

2001-08-10

1,671 reads

Technical Article

Email using CDONTS (via smtp)

Here is a very basic example script for sending emails via CDONTS. This comes from the sqlmag web-site forum. Although fine, remember that it will use the local SMTP server to forward emails onto the destination user. If your servers smtp process can not reach an exchange/group-wise/other mail box on your network, then this code […]

You rated this post out of 5. Change rating

2001-08-09

3,546 reads

Technical Article

Generate Insert Statements Easily

This script will generate insert statements for the given tables. You can pass the tables names, separated by commas, into sp_DataAsInsCommand stored procedure as in the example below: EXEC sp_DataAsInsCommand 'employee,titleauthor,pub_info' Updated on 5/25/01 to correct an issue with columns that are short like a column defined as char(1), to correct another issue with the […]

3 (9)

You rated this post out of 5. Change rating

2001-08-09

4,628 reads

Blogs

Level Up Your SQL Skills: The Best Intermediate to Advanced Courses

By

In the data-driven landscape of 2024, advanced SQL isn't just a nice-to-have, it's a...

Query deadlock info in Azure SQL DB

By

A couple of weeks ago, a developer came to me and wanted to know...

MSSQL Database Property LastGoodCheckDbTime to Get the Last Successful DBCC CHECKDB on a Database

By

Database Property LastGoodCheckDbTime to Get the Last Successful DBCC CHECKDB on a Database As one...

Read the latest Blogs

Forums

SQL SSRS license info

By mxy

hello,   i am trying to find where SSRS edition and product key information...

Baseball Everywhere

By Ryan Booz

Comments posted to this topic are about the item Baseball Everywhere

How to run custom python module on SQL Server?

By yyang5823

I am working on a small test script on SQL server 2022 using python...

Visit the forum

Question of the Day

Sensitivity Ranks

I want to use the ADD SENSITIVITY CLASSIFICATION DDL to mark some columns in my SQL Server 2022 database as PII. Can I use this code?

ADD SENSITIVITY CLASSIFICATION TO dbo.sales.price,
    dbo.sales.discount
WITH (
    LABEL = 'Highly Confidential',
    INFORMATION_TYPE = 'Financial',
    RANK = 'INTERNAL ONLY'
);

See possible answers