Scripts

Technical Article

Smooshing String Function

Smooshing - The act of removing all non-alphanumeric characters from a string. We have found several areas of our application where we need to perform cleaning on strings. The following is a SQL function which can be used to remove any non-alphanumeric characters. To use the function create the script and then SELECT dbo.fn_SmooshIt('B?\RU.,C>}E') will […]

You rated this post out of 5. Change rating

2002-07-26

537 reads

Technical Article

Retrieve column attributes

Given database, owner, table, and column names, this procedure returns one from among several column attributes such as type definition, defaults, and other types of constraints.  E.g., to retrieve the type definition of the 'pubs' database's 'author.address':DECLARE @attrib VARCHAR (500)      , @msg    VARCHAR (8000)EXEC p_get_column_attribute 'TYPEDEF'              […]

5 (1)

You rated this post out of 5. Change rating

2002-07-24

125 reads

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

374 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

105 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

132 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

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

122 reads

Blogs

Microsoft finally adds Tenant Switcher for Fabric / Power BI

By

Praise whatever deity you believe in, because it’s finally here, a tenant switcher for...

Microsoft Releases Windows 11 ARM ISO – A Game Changer for ARM-Powered Devices

By

Yesterday, Microsoft released the highly anticipated Windows 11 ARM ISO image, marking a major...

Building Effective Data Governance Framework: Top Areas to Focus On

By

The post Building Effective Data Governance Framework: Top Areas to Focus On appeared first...

Read the latest Blogs

Forums

Pull mssql to Postgres

By Bruin

Does anyone have a script\example that would connect to SQL server instance run a...

Fill in missing hours for each VisitID during the day

By NineIron

create table #T ( VisitID varchar(30), ER_Date date, HR int ) insert into #T(VisitID,...

Database copy for report work load

By ashrukpm

Hi Team, I am looking for a an help, Please see my problem below....

Visit the forum

Question of the Day

The Hash Join I

What are the two inputs called to a hash join operation in SQL Server? (choose 2)

See possible answers