Cade Bryant


Technical Article

View all settings for all databases on your server

My stored procedure, sp_dbsettings, allows you to view, in a cross-tabular format, all the common options and their values for all the databases on your server.  Optionally, you can pass a database name as an argument if you just want to view the settings for one database (i.e., EXEC sp_dbsettings 'Northwind').  Otherwise it shows info […]

You rated this post out of 5. Change rating

2002-10-09

633 reads

Technical Article

Find the Nth Occurrence of a Character in a String

T-SQL's CHARINDEX() function is a useful for parsing out characters within a string.  However, it only returns the first occurrence of a character.  Oftentimes one needs to locate the Nth instance of a character or a space, which can be a complicated task in standard T-SQL.  This function I wrote, imaginatively named CHARINDEX2(), allows one […]

4.64 (11)

You rated this post out of 5. Change rating

2002-09-27

30,146 reads

Technical Article

Stored procedure sp_for

The sp_for procedure provides simple single-statement loop processing for T-SQL statements, similar to the FOR command in the C language or the DOS command-line utility by the same name.It's syntax is similar to that of the DOS command.  It takes an argument to represent a variable, initialize the variable, set an increment, set an end […]

You rated this post out of 5. Change rating

2002-09-13

897 reads

Technical Article

FASTCOUNT() User-Defined Function (SQL 2000 only)

SQL Server's COUNT() function is a slow and expensive way to count a table's rows because it scans the entire table or index.  FASTCOUNT(), which I created, is much more efficient for this purpose - its only drawback being that it may return inaccurate results if a nonlogged (e.g., bulk) data modification operation was recently […]

You rated this post out of 5. Change rating

2002-09-10

840 reads

Technical Article

Using UDFs to avoid cursors

Let's say you have 2 tables: a Contacts table and a PhoneNumbers table (which stores all the phone numbers for each contact).  You are asked to write a query that returns each contact's name and a comma-delimited string of phone numbers for each contact, something like this:FirstName    LastName   PhoneNumbers---------    --------   --------------------------John      […]

You rated this post out of 5. Change rating

2002-07-22

998 reads

Technical Article

Preventing accidental overwrites with update SPs

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

How Redgate Flyway Can Boost Your DevOps Journey

By

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

Building a Docker image with Docker Build Cloud

By

In a previous blog post we went through how to build a Docker container...

Top 8 Courses to Learn SQL for Data Science in 2024 & Beyond

By

Businesses are drowning in data, but starving for insights. That's where SQL experts swoop...

Read the latest Blogs

Forums

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...

The Marked Transaction

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Marked Transaction

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