Create an audit trigger on a table

Sometimes you need an audit trigger on a table. I have created a generic trigger that will work for (almost)every table. if the audit table is not there yet, It will copy the table structure (but strip identity attributes) and put all the data in an AUDIT_ table.I believe this will work for almost every […]

5 (5)

2004-09-02

1,560 reads

Restore Backup and all TRANLOGS in a specific DIR

Many DBA's have a Maintenance plan running that creates a backup every night and a transaction log backup every hour.Restoring them to another server (for whatever reason) can be a tedious job. That is why I wrote this T-SQL script.It will read the contents of a backup directory created by the maintenance plan and create […]

5 (1)

2004-06-25

898 reads

Stored Proc with optional parameters

Sometimes people want a Stored Proc with optional parameters. A lot of times people will use a coalesce for this. The problem with optional paremeters is that the query plan will never be an exact mach for that specific query. ( You never know what paremeters are filled..... )To solve this problem look at the […]

2002-12-06

418 reads

Using a MEMORY table as an array

I liked the script of using a table as an array. But Didn't liked the cursor in it so I rewrote the script so that it uses a memory table.I tested it in the Query analyzer and this one is indeed faster. So all the people out there yelling that a memory table is faster […]

2002-08-07

1,161 reads

Blogs

Transaction log Information gathering

By

Here are the different ways to know the tlog file related information sys.dm_db_log_stats –...

What's New in SQL 2019? at BRSSUG

By

Thanks to everyone who joined the BRSSUG for a night all about SQL Server...

Data Lake Architecture using Delta Lake, Databricks and ADLS Gen2 Part 3

By

This is the third post in a series about modern Data Lake Architecture where...

Read the latest Blogs

Forums

Using crypt_gen_random to generate unique Serial Numbers

By iviewtheworldthroughmylens

Trying to generate unique serial numbers with alphanumerics (A-Z,a-z,0-9) and no special characters.Used below...

OPENQUERY is not inserting identical rows

By Johnny D

Hi, Thanks in advance for any help. I am trying to insert into a...

Azure file copy creating a directory to hold the renamed file

By Irish-Toon

Hi All, I'm pretty new to azure and am hitting the following problem. I've...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers