Miscellaneous

Technical Article

Change the User Defined Data type

  • Script

User Defined Data Types (UDF) is one of the useful concepts in SQL Server. However UDF can't be modified after they are being used. You would have to remove your User Defined Data Type from each table before you can change it. This will be a big job under certain circumstances.This procedure changes all tables […]

You rated this post out of 5. Change rating

2002-04-19

1,002 reads

Technical Article

Write Reports from SQL to Disk (Even HTML!)

  • Script

Ever need to write reports out to a folder? I have found that creating output files are SA-WEET! (and easy too) The sample script uses BCP to create an HTML file.This process works well for reports that need to be generated nightly and take too long to run in real time.  Use an SMTP mail […]

You rated this post out of 5. Change rating

2002-04-18

4,316 reads

Technical Article

Truncating and deleting all tables in a database

  • Script

Sometimes, during test stage, you may need to truncate or delete all your tables in a database, without droping constraints, truncating and recreating constraints (DRI). You can use the TRUNCATE TABLE statement to removes all rows from a table without logging the individual row deletes, but tables referenced by a FOREIGN KEY constraint can not […]

4.67 (3)

You rated this post out of 5. Change rating

2002-04-17

1,546 reads

Technical Article

Decimal to Binary Conversion for event scheduling

  • Script

This procedure was written to create an event schedule     where the schedule may have non-consecutive days.    The input for the procedure is START DATE, END DATE, and DAYMAP    The DAYMAP input parameter is a decimal number whose binary representation    describes the schedule days over potentially a 4 week period (read from right to left).    […]

You rated this post out of 5. Change rating

2002-04-17

293 reads

Technical Article

Get users permissions with mapping thru role.

  • Script

This procedure is similar to sp_helpprotect except to extends a bit on the concept with roles involved. If for instance a user has right on a TableX but they are not mapped directly to the user but instead to a role then sp_helpprotect does not tell you this. This will tell you how the user […]

You rated this post out of 5. Change rating

2002-04-16

1,702 reads

Technical Article

List of triggers in a database

  • Script

Give the following information, about triggers in the database.Parent_Name      Parent_Type Name                         Type               Insert Update Delete IsFirstInsertTrigger IsFirstUpdateTrigger IsFirstDeleteTrigger IsLastInsertTrigger IsLastUpdateTrigger IsLastDeleteTrigger

4.5 (2)

You rated this post out of 5. Change rating

2002-04-16

818 reads

Technical Article

Preventing accidental overwrites with update SPs

  • Script

Say you wanted to create an SP for updating records in a database.  How would you do this in such a way as to allow your users to edit only a subset of fields in the record, without overwriting the other fields, and without requiring verbose IF blocks and CASE statements in your code?Simple.  Use […]

You rated this post out of 5. Change rating

2002-04-16

198 reads

Blogs

Episode 11 of Simple Talks: Oracle

By

The 11th episode is now live, recorded a few weeks ago at the PASS...

A New Word: Mornden

By

mornden – n. the self-container pajama universe shared by two people on a long...

SQL Training: Black Friday Deals Up to 75% Off

By

This Black Week, don't just get a discount—get ahead! Whether you're a total newbie...

Read the latest Blogs

Forums

Blob Storage automated downloads

By Brandie Tarvin

Dipping my toes into the waters of Azure and of course before I get...

Announcing SQL Server 2025

By Press Release

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

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