Maintenance and Management

Technical Article

Replace Object Owner

  • Script

This SP is used to identify and replace the owner of the database objects. This SP will give display object id, object name, owner id, owner name and concatenate object + owner name with brackets. SP does change the owner for the following objects. SP should available in "master" database to execute in more than […]

You rated this post out of 5. Change rating

2005-12-06 (first published: )

320 reads

Technical Article

Grant EXECUTE permission to users

  • Script

This procedure will assist in granting execute rights to a database user to all the stored procedures in a database The parameters to this procedure are the databasename and the username to whom EXECUTE rights need to be given to The assumption here is that the user already has access rights to the database mentioned […]

You rated this post out of 5. Change rating

2005-05-05 (first published: )

220 reads

Technical Article

Update statistics in all database (sp_updatestats)

  • Script

This script permit executes the sp_updatestats in all databases at same time.First I create the stored procedure above in an admin database, for sample I create one database with ADMIN name where I put all administration objects create for me. You can create this sp in exist db, if you want.Now you can execute this […]

4.5 (2)

You rated this post out of 5. Change rating

2005-04-14 (first published: )

4,148 reads

Technical Article

Find maximum values for all "int" columns

  • Script

/******************************************************** "CheckAllInts" Find all columns in all user tables in a database defined as "int", and get the maximum value for the column. Uses a cursor and logs the results to a table. (One-time CREATE TABLE statement at top of script). Successive runs over an appropriate period of time would allow one to find how […]

You rated this post out of 5. Change rating

2005-04-11 (first published: )

294 reads

Technical Article

shrinking logs: how much data will be reclaimed

  • Script

This script will show you how much diskspace can be reclaimed by shrinking all the logfiles of userdatabases using a DBCC SHRINKFILE(2) command. Often the spacegain is much smaller then expected. SQL Shrinks logfiles the end of the file until it finds the active part of the logfile. (If the active part of the logfile […]

You rated this post out of 5. Change rating

2005-03-21 (first published: )

426 reads

Technical Article

Automated Profiler trace import

  • Script

This stored procedure was written to complement the automated profiler trace create procedure (should be here somewhere - check the scripts).Bascially, given the database (sample script to create the database included, but you may want to personalize it), this stored procedure will import the tracefile content into the table, which is indexed on expected search […]

You rated this post out of 5. Change rating

2005-10-03 (first published: )

361 reads

Technical Article

Automated Profiler trace Create

  • Script

This stored procedure is created to be invoked (in my case by SQL Server scheduled job), and will then create a tracefile to a specified file location (ensure that if this is NOT local, your SQL Server Agent runs on a domain account that has access to that drive. The Stored procedure will create files […]

You rated this post out of 5. Change rating

2005-03-16 (first published: )

433 reads

Technical Article

Set Extended Properties for Every Table

  • Script

Extended properties are a neat feature in SQL Server 2000 that let you set meta data for an individual object. This stored procedure is a baseline sproc that lets you set the properties of every object in a DB to a given value. For example, if you baseline your database at 1.5.0, you can set […]

You rated this post out of 5. Change rating

2005-03-02 (first published: )

195 reads

Technical Article

SQL Server Database File Sizes

  • Script

This script creates a SQL_Statistics table in the Mater Database and then scroll through the existing databases on the server and gathers the Servers Name, logical device name, the file name and the file size and writes it to the table alond with a date time stamp.We run it once a month to gather the […]

You rated this post out of 5. Change rating

2005-02-22 (first published: )

532 reads

Blogs

How to find free space in Azure PosgreSQL

By

I wanted to figure out how big (or approximately how big) my dump file...

T-SQL Tuesday #180: Good enough is perfect Roundup

By

This month, I prompted bloggers to discuss whether good enough is perfect. Thank you to all...

Using SQL Compare with Read-only Access

By

Recently a customer asked if SQL Compare and SQL Data Compare can be used...

Read the latest Blogs

Forums

Announcing SQL Server 2025

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Announcing SQL Server 2025

Running Steve's Code

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Running Steve's Code

New SQL Server 2022 Functions

By Steve Jones - SSC Editor

Comments posted to this topic are about the item New SQL Server 2022 Functions

Visit the forum

Question of the Day

Running Steve's Code

Can you run this code in any of your SQL Server 2019 databases without error?

CREATE OR ALTER PROCEDURE [dbo].[StevesAmazingProc]
AS
    
        SELECT Consumer_ID ,
               Trend_Category ,
               Bit_Trace
        FROM    NewWorldDB.dbo.MarketTrend;
    
GO

See possible answers