T-SQL

Technical Article

Global System UDF to return ISO Date string

  • Script

Updated for Permission assignment change 1/11/1006. Ok, I'll bet that you are asking, What is a Global System UDF, right? By Global I mean that the UDF is available from any database on the server. By System I mean that the two part naming rule does not apply to this scalar function. The UDF conversion […]

(1)

You rated this post out of 5. Change rating

2006-01-26 (first published: )

455 reads

Technical Article

Get the #lines in a TSQL view/SP/UDF of a String

  • Script

The following procedure gets a TSQL program object(View/UDF/stored procedure) and a given stringIt searched object's source code for the string and returns the number of lines where a match is found.This is helpful when we want to search all our TSQL code for a specific table name, column etc. and investigate where it is referenced […]

You rated this post out of 5. Change rating

2005-06-02

115 reads

Technical Article

Return WeekNo (ISO 8601 standard)

  • Script

In MS SQL, January 1 of any year defines the starting number for the week. The DATEPART(wk, 'Jan 1, xxxx') always return 1. However, a lot of reports Week No is actually based on ISO 8601 standard, that is January 1 of any year can be Week 53/52 or Week 1. (http://www.merlyn.demon.co.uk/weekinfo.htm#IDC)The Rule is as […]

You rated this post out of 5. Change rating

2005-06-14 (first published: )

308 reads

Technical Article

Check missing exec permission on Stored proc

  • Script

Stored procedure usp_CheckMissingPermission_for_User checks missing exec permission for given user or group on all the stored procedures within the database. It not only detects missing exec permission, but also generates a scripts for you to fix the problem.

You rated this post out of 5. Change rating

2005-05-30 (first published: )

237 reads

Technical Article

Generate Insert Statements Easily - Updated

  • Script

This script will generate insert statements for the given tables. You can pass the tables names, separated by commas, into sp_DataAsInsCommand stored procedure as in the example below:EXEC sp_DataAsInsCommand 'employee,titleauthor,pub_info'Updated on 5/25/01 to correct an issue with columns that are short like a column defined as char(1), to correct another issue with the Identity column […]

You rated this post out of 5. Change rating

2005-06-01 (first published: )

356 reads

Blogs

Upgrading SQL Server Containers on the Laptop

By

I don’t have SQL Server installed on my laptop. In an effort to keep...

How to Find Expensive Queries in Amazon Redshift

By

Slow-running queries can degrade your Redshift cluster’s performance and lead to increased costs. Identifying...

The Notification Trap: How Input Fatigue Is Killing Deep Work in Tech

By

If you’ve been here before, you know this blog is usually about SQL Server,...

Read the latest Blogs

Forums

SQL 2019 instance with AG, across 2 Windows 2016 OS servers - OSin-place upgrade

By millardus

Hi all Can I get some perspective from the community please on performing in-place...

How Long is a Long I/O?

By Steve Jones - SSC Editor

Comments posted to this topic are about the item How Long is a Long...

T-SQL Trigonometric Functions in SQL Server

By Imran2629

Comments posted to this topic are about the item T-SQL Trigonometric Functions in SQL...

Visit the forum

Question of the Day

How Long is a Long I/O?

In SQL Server 2025, a long I/O is recorded in the error log with message 833. How long much an I/O request be outstanding before this message is written to the log?

See possible answers