Error handling inside stored procedure
Following script gives an example how to handle errors inside stored procedure with returning information about type of error occured
2002-04-17
1,692 reads
Following script gives an example how to handle errors inside stored procedure with returning information about type of error occured
2002-04-17
1,692 reads
There are times you want to kill all the connections in a database. This would do that trick. This can be very useful when you replace a database regularly and some connections still exist so your automated restore fails. You can issue this command to kill all the connections before issuing a restore command.
2002-04-17
2,519 reads
During some maintenance task, you might not want any one to connect to a database. This script would help you do that. If you need to run this script, you might also need my other script to kill connections.
2002-04-17
786 reads
Sometimes, during test stage, you may need to truncate or delete all your tables in a database, without droping constraints, truncating and recreating constraints (DRI). You can use the TRUNCATE TABLE statement to removes all rows from a table without logging the individual row deletes, but tables referenced by a FOREIGN KEY constraint can not […]
2002-04-17
1,588 reads
This script will be helpful to only those people who arehaving identical database with different names.This script can be used to copy single or multiple tables from one database to anotherThe parameters @tname , source database and target database are important for the script to work. In the script below I have considered two databases […]
2002-04-16
1,613 reads
This script will be helpful in detecting duplicate indexes created ( on the same set of field(s) ). These would have been created by accident, because of their existence the performance will be affected.
2002-04-16
1,833 reads
This procedure is similar to sp_helpprotect except to extends a bit on the concept with roles involved. If for instance a user has right on a TableX but they are not mapped directly to the user but instead to a role then sp_helpprotect does not tell you this. This will tell you how the user […]
2002-04-16
1,723 reads
Give the following information, about triggers in the database.Parent_Name Parent_Type Name Type Insert Update Delete IsFirstInsertTrigger IsFirstUpdateTrigger IsFirstDeleteTrigger IsLastInsertTrigger IsLastUpdateTrigger IsLastDeleteTrigger
2002-04-16
845 reads
Say you wanted to create an SP for updating records in a database. How would you do this in such a way as to allow your users to edit only a subset of fields in the record, without overwriting the other fields, and without requiring verbose IF blocks and CASE statements in your code?Simple. Use […]
2002-04-16
214 reads
With this script you can supply an money value such as $12525.83 and it will return the word value "Twelve Thousand Five Hundred And Twenty-Five Dollars And Eighty-Three Cents".It is comprised of a table for Number to Name and a procedure to parse into it's piecesNOTE: This only goes to billions at this point, but […]
2002-04-11
438 reads
By Steve Jones
I was messing around with SQLCMD and I realized something I hadn’t known. I’ve...
By gbargsley
One of the first things I review when I inherit a new SQL Server...
By Arun Sirpal
It’s 07:43. Someone’s already left a message. “Something’s wrong with the DB server.” You...
Cs: 0817839777 Jl. Ahmad Yani No.39 A, Rw1, Sidokumpul, Kec. Sidoarjo, Kabupaten Sidoarjo, Jawa...
I have an issue where I have a Bill of Material list of items...
Comments posted to this topic are about the item Follow Your Hunch
I have a SQL Server 2022 English default installation on a server. I want to detect if there are any upper case characters in rows and I have this code:
SELECT CustomerNameID,
CustomerName
FROM dbo.CustomerName
WHERE CustomerName = LOWER(CustomerName)
Here is the sample data I am testing with:
CustomerNameID CustomerName 1 John Smith 2 Sarah Johnson 3 MICHAEL WILLIAMS 4 JENNIFER BROWN 5 david jones 6 emily davis 7 Robert Miller 8 LISA WILSON 9 christopher moore 10 Amanda TaylorHow many rows are returned? See possible answers