Miscellaneous

Technical Article

Find a string in DB objects.

  • Script

Find a string in Procedures, Triggers, Constraints, Defaults, Functions, and Views. First off this will not work for any items that have the WITH ENCRYPTION remark in them. With this is can pose a string such as 'INSERT' against all the 'P'rocedures to get a return of which Procedures have an INSERT statment in them […]

5 (1)

You rated this post out of 5. Change rating

2002-02-21

1,696 reads

Technical Article

Auto generate sp's for any table * usp_create_sps

  • Script

If you've ever been stuck having to write stored procedures to support an application, check this script out.  This script will automatically generate seperate parameter driven select, insert, delete, and update stored procedures.  Simply call these stored procedures from your application, passing parameters.  This stored procedure requires only one parameter; table name.  Creates scripts with […]

1 (1)

You rated this post out of 5. Change rating

2002-02-21

325 reads

Technical Article

UPDATED hx_IdentityColumnAdvanced

  • Script

That is a good script but with a little problem. It shows 1 less table than in the schema. Its not a script from me so I have not changed the contributor's name.The only change is I have made is moved FETCH NEXT statement at the end of the loop and removed IF @@FETCH_STATUS = […]

You rated this post out of 5. Change rating

2002-02-18

147 reads

Technical Article

Analyze Space Used for each Table

  • Script

The following batchfile demonstrates how to use Windows command extension to extract the values of sp_spaceused for each table in the database. The output of sp_spaceused itself contains strings that do not get easily analyzed. The batch file extracts the numbers and outputs the sizes for each table in the database.Copy the batchfile to a […]

You rated this post out of 5. Change rating

2002-02-18

2,275 reads

Technical Article

DATEMY - Covnerts and validates MM/YY, MM/YYYY

  • Script

If you've ever needed a convenient and quick way to convert/validate what could possibly be a mm/yy or mm/yyyy date to mm/dd/yyyy (date of month is 01) check out this custom function.  Eg:  select dbo.datemy('04/02') outputs smalldatetime '2002-04-01 00:00:00'.  Select dbo.datemy('04/2002') outputs the same smalldatetime '2002-04-01 00:00:00'.

You rated this post out of 5. Change rating

2002-02-15

870 reads

Technical Article

Rename User Login

  • Script

You can effectively rename a user account but as this is messing wit the system tables I would suggest dropping and adding the user back. But for those of you who really want to know how here it is.First off I tested this and it works fine renaming a user. However this is directly modifying […]

You rated this post out of 5. Change rating

2002-02-14

898 reads

Technical Article

Send notifications on job STEP failures (trigger)

  • Script

Have you ever wanted to have SQL note a failure on a step, yet continue running the job.  I found it to be annoying that you have to fail (and end) a job in order to send a message to an operator.  I have processes that run at off times, I want to know when […]

5 (2)

You rated this post out of 5. Change rating

2002-02-13

2,268 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