T-SQL

Table of Numbers

  • Script

A user-defined function that returns a table of numbers between a and b (using the most efficient way I can think of).e.g.  select * from table_of_numbers(1, 4) gives a table with rows 1, 2, 3 and 4.

5 (1)

2002-05-09

127 reads

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 […]

2002-05-09

275 reads

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)

2002-04-16

1,577 reads

Detection of Broken Forign Key Relationship

  • Script

Under special circumstances, it could happen that database contains "orphan" records. Data in dependant table exists without it's "parent" record in a master table. It could be caused by a bulk insert operation without CHECK_CONSTRAINTS option, or by disabling foreign key for a while or adding a foreign key to a table that already contains […]

5 (1)

2002-03-27

183 reads

Blogs

Database DevOps Deployment to Azure–Webinar

By

You can register now, but on Dec 3, I have a webinar with Microsoft...

[PowerShell Newbie] Using Start-Transcript

By

This week we are going to launch a blog series geared towards folks that...

My Experience on Geeks on Screen with Coffee

By

Last week on appeared on Geeks on Screen with Coffee which broadcast on YouTube...

Read the latest Blogs

Forums

Finding Thanks

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Finding Thanks

Python Static Methods

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Python Static Methods

Query SSISDB For Components

By alex.sqldba

Evening All, I want to identify all SSIS packages deployed into SSISDB that contain...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers