Miscellaneous

Technical Article

Trigger Generator for data audit

  • Script

This Procedure generates 3 triggers (for Insert, Update & delete). The purpose of these triggers is to keep a SIMPLE audit trail. Create the table and the procedure in the database to which you want to have the auditing facility. To include a table for auditing run the procedure with Table Name as the parameter.

You rated this post out of 5. Change rating

2002-10-09

1,185 reads

Technical Article

Proc to script a user role and object permissions

  • Script

I wanted to be able to prepare a script of User Roles and permissions for objects in a database so I can be prepared for backup and disaster recovery scenarios. I also wanted to be able to audit the permissions for each role.I wrote this stored procedure to do this.  The usage is:Use NorthwindgoDECLARE @RC […]

You rated this post out of 5. Change rating

2002-10-09

925 reads

Technical Article

View all settings for all databases on your server

  • Script

My stored procedure, sp_dbsettings, allows you to view, in a cross-tabular format, all the common options and their values for all the databases on your server.  Optionally, you can pass a database name as an argument if you just want to view the settings for one database (i.e., EXEC sp_dbsettings 'Northwind').  Otherwise it shows info […]

You rated this post out of 5. Change rating

2002-10-09

639 reads

Technical Article

sp_GetUserInfo

  • Script

Returns database user information as a runnable script for the specified database. The default is master. Great for restoring user access and permissions after a restore to a development server. Run prior to the restore and save the output to an sql file.

You rated this post out of 5. Change rating

2002-10-09

1,040 reads

Technical Article

sp_GetDirInfo

  • Script

Returns information about the files in the specified directory and/or subdirectories (if requested) and the total bytes for those files. Directory names are excluded so that the total bytes can be computed using the compute clause but you can specify that they be included at the expense of no total bytes. This sp uses the […]

You rated this post out of 5. Change rating

2005-11-25 (first published: )

495 reads

Technical Article

sp_CompareTblCnts

  • Script

This stored procedure does a quick table comparison between 2 databases that are supposed to be the same. Tables found on either db but missing from the other are reported as are record count differences for matching tables. Establish a linked-server with appropriate permissions to compare across servers. Compile in master.

You rated this post out of 5. Change rating

2002-10-09

120 reads

Blogs

The Book of Redgate: Customer Quotes

By

Many organizations list customer testimonials and quotes on their websites or literature. It makes...

Using Cron in Postgres Flex

By

pg_cron is a simple cron-based job scheduler for PostgreSQL that runs inside the database...

Can I Change a Primary Key Value? #SQLNewBlogger

By

I heard someone say recently that you can’t change a primary key value in...

Read the latest Blogs

Forums

Life Moves Pretty Fast

By Grant Fritchey

Comments posted to this topic are about the item Life Moves Pretty Fast

Parse XML data from SQL table using temp tables and variables

By Lord Slaagh

Hello SSC, Happy Friday! I have to optimize a process that uses dynamic SQL...

50 Years of Microsoft

By Steve Jones - SSC Editor

Comments posted to this topic are about the item 50 Years of Microsoft

Visit the forum

Question of the Day

Multiple Collations

Can I have a collation expression like this in SQL Server 2022?

...
WHERE ColumnA = ( 'abc' COLLATE French_CI_AS) COLLATE French_CS_AS
...

See possible answers