Stored Procedure to Pause Execution
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,252 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,252 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
579 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
479 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
745 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,606 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 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 […]
2002-09-26
1,143 reads
By Steve Jones
Redgate had some Claude training recently, which I went through as my knowledge has...
By Steve Jones
gnossienne– n. the awareness that someone you’ve known for years still has a private...
How I used AI for this postChatGPT to generate images based on info specifically...
Comments posted to this topic are about the item Demo Tracking Dropped Objects
Comments posted to this topic are about the item Randomly Selecting Columns and Rows...
Comments posted to this topic are about the item How Can SQL Server Detect...
If I want to return information about all Database Mail profiles on my instance from T-SQL, how can I do this?
See possible answers