T-SQL

Technical Article

sp_MSforeachview - Perform an action on each view

  • Script

This stored procedure loops through each view and performs an action on that view, like counting or printing the records. Please install this stored procedure in the MASTER database. For full usage instructions and advanced parameters please see the article about it at http://www.sqlservercentral.com/columnists/bknight/sp_msforeachworker.asp. Shortened version of the usage (there are a lot more parameters […]

You rated this post out of 5. Change rating

2002-06-14

1,953 reads

Technical Article

Stored procedure for viewing trigger details

  • Script

This is a stored procedure for viewing details of trigger. It accepts trigger name as a optional parameter. When specified, it shows details of only that trigger. If no trigger name is specified shows the details of all the triggers in that database. this SP is created in master database but can be called from […]

You rated this post out of 5. Change rating

2002-06-12

316 reads

Technical Article

Multiple Replace

  • Script

Like the replace function, but can replace more than 1 value at a time.e.g. select dbo.multiple_replace('hello', 'e', '1', default) gives 'h1llo'.  Equivalent to: select replace('hello', 'e', '1')e.g. select dbo.multiple_replace('hello world', 'e;w;ld', '1;2;END', default) gives 'h1llo 2orEND'e.g. select dbo.multiple_replace('hello world', 'e$w$ld', '1$2$END', '$') gives 'h1llo 2orEND'

5 (1)

You rated this post out of 5. Change rating

2002-05-09

432 reads

Technical Article

UDF to convert Seconds to DDD:MM:MM:SS Format

  • Script

This function takes a number of Seconds in BIGINT format and calculations and displays that in a DDD:HH:MM:SS format.I wrote this because I needed to work out the duration between two datetimes and required the result to be displayed in a Report (VARCHAR (12)) format from a Select statementTo Use:SELECT dbo.csp_SecondsToDaysHoursMinutesSeconds(DATEDIFF(SS, , ))  AS DurationFROM […]

You rated this post out of 5. Change rating

2002-05-09

312 reads

Technical Article

Copying Data from one Database to Another

  • Script

This script will be helpful to only those people who arehaving identical database with different names.This script can be used to copy single or multiple tables from one database to anotherThe parameters @tname , source database and target database are important for the script to work. In the script below I have considered two databases […]

5 (1)

You rated this post out of 5. Change rating

2002-04-16

1,589 reads

Blogs

The Ireland and UK DevOps Roadshow

By

We’re taking the roadshow across the water. Hope the plane makes it. The Redgate...

SQL Aggregate Functions: Your Essential Guide & Cheat Sheet

By

SQL aggregate functions are your go-to tools for transforming raw data into actionable insights....

T-SQL Tuesday #174 – My Favorite Interview Question

By

This month is a great topic to me. I think growing and improving your...

Read the latest Blogs

Forums

Aggregating over multiple columns

By Chrissy321

Hello friends, See setup code below. I have a working solution but I am...

select string removing two sets of characters

By HeftSteady

Hi  , I need help replacing a certain strings from a query response. My...

Swapping ports between 2 instances - can't understand results

By terry999

Have 2 instances on the same TestServer 1. Default 2014 Dev edition on port...

Visit the forum

Question of the Day

Full Text Editions

In which editions can I use Full-Text and semantic search?

See possible answers