T-SQL

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

97 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: )

280 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: )

222 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: )

331 reads

SQLServerCentral Article

Recursive Queries in SQL:1999 and SQL Server 2005

  • Article

How many of you have written resursive queries in SQL? Or any language since school for that matter? Not many people write recusrive queries because of the complexity, the difficulty to understand how they work, and the chance for heap overflows. However, SQL Server 2005 implements Common Table Expressions and recursion in a way that is much easier to code and incorporates some safeguards. New author SQL Server MVP Frederic Brouard has written a fantastic article looking at resursive queries.

4.83 (64)

You rated this post out of 5. Change rating

2008-05-16 (first published: )

68,034 reads

Technical Article

HexToINT

  • Script

An optimized function for converting a HEX string into a INT. Built for being faster then other HexToDec converters.Slightly slower then HexToSMALLINT.If there is any faster function to do this conversion, I am intrested of using it instead.

You rated this post out of 5. Change rating

2005-05-04 (first published: )

279 reads

Technical Article

Optimized HexToSMALLINT

  • Script

An optimized function for converting a HEX string into a SMALLINT. Built for being faster then other HexToDec converters.If there is any faster function to do this conversion, I am intrested of using it instead.

You rated this post out of 5. Change rating

2006-10-11 (first published: )

116 reads

Blogs

Friday Basics: the CIA Triad

By

In information security (INFOSEC), there several foundational concepts and principles. One of the ones...

A New Word: the standard blues

By

the standard blues– n. the dispiriting awareness that the twists and turns of your...

How Redgate Flyway Can Boost Your DevOps Journey

By

A brief introduction to the tool and its advantages for database migrations DevOps is...

Read the latest Blogs

Forums

client_app_name is empty in Extended Events output but present in sp_who2

By Pete Bishop

I'm tracing activity on one database and would like to include the client_app_name in...

How to compare data in customer table with other customers to find related cust

By Zond Sita

select Custno, Addr1, City, Res_Phone, Bus_Phone, Fax_Phone, Marine_Phone, Pager_Phone, Other_Phone, email1, email2 from customer...

process records in loop

By Bruin

I'm only processing 50,000 records not everything from the Table where there are 250,00...

Visit the forum

Question of the Day

The Marked Transaction

I want to mark a transaction in the log as a recovery point. How do I do this in my code if I use the transaction, myTran?

See possible answers