Easy table pivot
Pivot a table from vertical rows to horizontal results with a single select statement; no cursor.
2002-10-04
2,425 reads
Pivot a table from vertical rows to horizontal results with a single select statement; no cursor.
2002-10-04
2,425 reads
Ever needed to pause in a SQL script? Or wanted to simulate a long running process for testing? This stored procedure accepts an integer and pauses for that many seconds.
2002-10-04
1,253 reads
I use this script on some (not all) databases to backup the Logs when they reach a certain level of being full. For example, when the log is 60% full the log will be backed up.Change the ????? values and this script is ready to go.
2002-10-03
580 reads
This SP will generate the frequency of each occurrence in a field or for every field in a table. The syntax isexex sp_freqall , , , , for example:exec sp_freqall utems2000_2001, null,lastname, 100would return a table (with a field name and a count) for each field in the utems2000_2001 table, except the lastname field and […]
2002-10-03
249 reads
This script can be used on SQL Server 2000 databases. Some minor modifications are needed for SQL Server 7.0. This will report the DBCC SHOWCONTIG values for all the user tables, in all the databases on the server.
2002-10-03
481 reads
This stored procedure will find all sprocs, views and tables that have been misnamed (not owned by DBO) and change the ownership to DBO. Executes sp_changeobjectowner to change the object owner for each object in the database.
2002-10-02
600 reads
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 […]
2002-10-01
746 reads
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 […]
2002-10-01
1,042 reads
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 […]
2002-09-27
32,614 reads
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 […]
2002-09-26
348 reads
A RAG pipeline that answers questions in the demo is not the same thing...
By Steve Jones
“A multitude of bad ideas is necessary for one good idea” – from Excellent...
Yesterday I gave a talk for MSSQLTips called “Building a DBA Agent for Your...
I've got a web application for my side business. I've added a SQL Server...
Comments posted to this topic are about the item Looking for New Blood
Comments posted to this topic are about the item Server-Level Row Counts for Tables...
What types of secondary replicas are available for the Azure SQL Database Hyperscale edition?
See possible answers