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,588 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

900 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

420 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,162 reads

Blogs

Daily Coping 18 Sep 2020

By

I started to add a daily coping tip to the SQLServerCentral newsletter and to...

Optimize for Unknown for Inline Table-Valued Functions

By

I had a curious performance issue today. An inline table-valued function (iTVF) was performing...

Daily Coping 17 Sep 2020

By

I started to add a daily coping tip to the SQLServerCentral newsletter and to...

Read the latest Blogs

Forums

SQL 2017 MLS - cant add new python packages

By sqldude7777

Hi I'm new-ish to MLS and have been trying to add new python packages...

Find row closest to date

By boehnc

Just having trouble getting this to work as I hoped. Trying to extract entire...

SQL Query - FULL JOIN multiple tables but return NULL results

By glennyboy

Good day! Need help with my sql query code; first FULL JOIN "ILEtransfer" no...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers