Maintenance and Management

Technical Article

Generate Delete Stored Procedure

  • Script

This procedure will generate a delete stored procedure against a provided table and column name in your database.  It will search for foriegn key constraints and create a delete statement for each one found in the database.  The procedure has three parameters:@table_name nvarchar(128) = the name of the source table@column_name nvarchar(128) = the name of […]

You rated this post out of 5. Change rating

2002-04-22

272 reads

Technical Article

Script to list all user and roles

  • Script

This script list all the users defined for each database on the server, it give the database name, the login name and the role defined.Its use full to have quick view of witch users are dbo on witch databaseEnsure that you have the result in grid in query analyzer, and just cut and paste the […]

1 (1)

You rated this post out of 5. Change rating

2002-04-18

947 reads

Technical Article

Script Generator for Triggers

  • Script

This Stored Procedure creates the script of all existing triggersOptionally it creates the script to drop the triggers too.Triggers may belong to different owners. This procedure takes care of it.In SQLServer Enterprise Manager there is a facility to generate scripts forTables, Views, Stored Procedures etc.But it won't generate script for triggers unless we include the […]

5 (6)

You rated this post out of 5. Change rating

2002-03-27

2,691 reads

Technical Article

Detect the Amount of Wasted Data Space in a Table for 2000

  • Script

SP_WASTED_SPACE will run through each column in your database and print a report of all the character columns. It will then print a report with :* The maximum length that a column is storing* The average length of data stored in each column* The amount of wasted space in each column* Hints on how to […]

You rated this post out of 5. Change rating

2002-03-14

1,123 reads

Blogs

A New Word: Fardle-dun

By

fardle-din – n. a long-overdue argument that shakes up a relationship, burning wildly through...

Lukáš Karlovský: I got the green light from management and built Fabric specialization from scratch

By

The post Lukáš Karlovský: I got the green light from management and built Fabric...

FIRST_VALUE vs. Min: #SQLNewBlogger

By

I had mentioned some new T-SQL functions for SQL Server 2022 and a commenter...

Read the latest Blogs

Forums

Migrating from SSRS 2008 (SP Integrated) to 2022 (Native)

By zootbot

Has anyone done a migration from sharepoint integrated ssrs to native? I'm not finding...

NC index creation duration question

By Coffee_&_SQL

Hey All, My setup is as follows: Table with Clustered Index on ID col....

CPU Performance Advice in SQL Server 2005

By JoeLee

I am having problems with CPU performance on SQL Server 2005. CPU spikes frequently...

Visit the forum

Question of the Day

Subqueries II

What is wrong (if anything) with this code?

SELECT *
 FROM Sales.SalesOrderHeader AS soh 
 WHERE customerid IN (SELECT soh.CustomerID 
                       FROM Sales.Customer AS C
   WHERE soh.CurrencyRateID = 1
   ORDER BY c.ModifiedDate)

See possible answers