Scripts

Technical Article

INSERTS that will STAY after a ROLLBACK is issued

Sometimes it is usefull to log stuff in SQL server while stored procs are running. If a long stored proc runs you sometimes want to be able to log a message in a loggin file. But what if a rollback occurs.... The message is lost as well.Here is a method to set up a seperate […]

You rated this post out of 5. Change rating

2002-10-01

725 reads

Technical Article

sp_checksize

This stored procedure checks the sizes of one or all databases (including total data, total log, data used/free, data used/free percentage, log used/free, log used/free percentage). If a database name is provided, it will only check the given db. If no parameters provided, all dbs will be checked and the total size of all dbs […]

You rated this post out of 5. Change rating

2002-10-01

1,026 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

31,271 reads

Technical Article

GET COUNT(*) from 1 table

IN a scenario where the user would like to retrieve the Count(*) from a table without any condition, in that case this query will workselect count(*) from 'Suppose product is the table,if the product table is light then its ok but if it contains a huge data, then this query can be used.select max(rowcnt) from […]

You rated this post out of 5. Change rating

2002-09-26

322 reads

Technical Article

Grant permissions to a role

A very simple script that will first create a role (if it does not exist yet) and then grant full permissions on tables, views and stored procedures to the newly created role. Of course, you can add any filtering (i.e. grant permissions only for tables beginning with "abc") or grant partial permissions (SELECT or DELETE […]

You rated this post out of 5. Change rating

2002-09-26

1,119 reads

Technical Article

Random string and random number generators

The first part will create 2 stored procedures with self-explanatory names. The second is a standalone SQL that may be used in any stored procedure, script or DTS package.The generated string does not have any spaces and include only lower-case letters. To include anything else just change the boundaries for ASCII codes in the script.The […]

1 (1)

You rated this post out of 5. Change rating

2002-09-26

548 reads

Technical Article

Find circular references in single table

The objective is to find circular references in a single table related to itself. The script deals with a sample table Skills that have a SkilGUID (primary key) field and a SkilParentGUID field which is a foreign key to the record's parent from the same table. The number of levels in the hierarchy is not […]

3.67 (3)

You rated this post out of 5. Change rating

2002-09-24

1,069 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

Upgrading SSIS and SSRS from SQL Server 2016

By Deni Kusdeni

Hi All, I have plan to upgrade SSIS and SSRS from SQL Server 2016,...

Do You Want a Microsoft Solution?

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Do You Want a Microsoft...

The Density Vector

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Density Vector

Visit the forum

Question of the Day

The Density Vector

When building statistics, there is the concept of density that refers to the duplicates in a table. How is this calculated?

See possible answers