Scripts

Technical Article

Count # occurrences of one string inside another

Scalar function 'f_contains' counts the number of times the first argument occurs within the second argument.Given:  @arg1, @arg2 (both VARCHAR), @cnt INTSELECT @cnt = dbo.f_contains (@f_search_for = @arg1                            , @f_container  = @arg2)

1 (1)

You rated this post out of 5. Change rating

2002-07-22

382 reads

Technical Article

Slice out string from within specified delimiters

Scalar function 'f_delimited' slices out of a passed-in string, from a specified position inside the string, that segment of it which is delimited on one or both sides by a specified delimiter.Example:  Print out a segment of a 'syscomments.text' column for a stored procedure 'p_proc', representing a line of code (i.e., the segment of 'syscomments.text' […]

You rated this post out of 5. Change rating

2002-07-22

109 reads

Technical Article

String-search on objects in a specified database

Procedure 'p_find_string' allows users to specify any database on a server in searching for a specified character string.  Supported for string-searching:  table columns, view columns, trigger, function, and procedure code.  Produces a report showing: object type, owner, object name, column id (for tables and views) or what line number (for triggers, functions, and procedures), and […]

You rated this post out of 5. Change rating

2002-07-22

140 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

1,030 reads

Technical Article

Checks Triggers status on User- Databases.

Introduction:SQL Server 7.0 introduced a new class of functions that return a wide range of property information that isn't readily available in SQL Server 6.5 and earlier versions. These functions have three general classes: TypeProperty, which returns information about a data type; ObjectProperty, which returns information about objects in the current database; and ColumnProperty, which […]

You rated this post out of 5. Change rating

2002-07-19

130 reads

Technical Article

Part I: Table Size Estimation

This script will provide the first four values required for estimating the size of a database table.  It will satisfy steps one and two in MS estimation process for the amount of space required to store the data in a MS SQL Server v7.0 or v2000 table:1    Specify the number of rows present in the […]

You rated this post out of 5. Change rating

2002-07-19

501 reads

Technical Article

sp_dir - Procedure to list database objects

Lists objects from database. Similar to 'dir' command from DOS 🙂Typical usage sp_dir 't' 'order*', 1     - returns list of all tables whose name start with 'order' plus their columns and data typessp_dir 'p' 'custom*_sp' -  returns list of all stored procedures whose name start with 'custom' and end up with '_sp'For list of […]

You rated this post out of 5. Change rating

2002-07-19

488 reads

Blogs

Local LLM Models at SQL Saturday Boston 2025

By

I’m starting a long trip at Boston this weekend. I’ll be there Saturday speaking,...

3 things you must do to start data quality management right

By

As a data & AI strategist who’s seen countless projects succeed and fail, I...

Set Theory vs. Batch Mode in SQL Server

By

Set Theory vs. Batch Mode in SQL Server Not long ago,...

Read the latest Blogs

Forums

Changing the Recovery Time

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Changing the Recovery Time

Getting More Time from AI

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Getting More Time from AI

When Page Prefetching Takes a Back Seat – Exploring Trace Flag 652 in SQL Server

By Chandan Shukla

Comments posted to this topic are about the item When Page Prefetching Takes a...

Visit the forum

Question of the Day

Changing the Recovery Time

I want to change the recovery time for a database running on SQL Server 2022. What are my options for setting the value in my ALTER DATABASE statement. If I run this code, what can I use in place of the xxx to define what 12 means?

ALTER DATABASE Finance 
 SET TARGET_RECOVERY_TIME = 12 xxx;

See possible answers