Drop all foreign keys
Drops all the foreign keys in a database. This is useful when rebuilding data warehouses.
2004-11-30 (first published: 2004-10-13)
1,505 reads
Drops all the foreign keys in a database. This is useful when rebuilding data warehouses.
2004-11-30 (first published: 2004-10-13)
1,505 reads
I have a table named employees with an identity column named id. Also,last_name is a column in the table named employees. I created the employeestable and inserted 9 rows in it. If I do a select * from employees, theoutput looks like this:id last_name1 a2 b3 c4 d5 e6 f7 g8 h9 iThen I deleted […]
2004-11-29 (first published: 2004-10-13)
143 reads
This script extends the "Find strings in text of stored procedures" Script by LiviuB and and now finds thestring and removes it. You may modify script to just comment out the text.This script removes the text (in this case 'set dateformat dmy') from all non-system stored procedures in a database.Modify the variable @searchstring to contain […]
2004-11-26 (first published: 2004-10-13)
283 reads
Easy and Fast way to check Backup details. One line query to check backup status for all the databases. No need to go to each database or schedule job. Even you can use this query in customized application to get all the details on a single screen.
2004-11-25 (first published: 2004-10-14)
734 reads
This script uses two undocumented stored procedures that retrieve all tables in the database in which it is run and lists the data and index sizes, the sum of these sizes, and the table's size percentage of the entire database. The results are presented in descending order of the sum of the data and index […]
2004-11-24 (first published: 2004-10-25)
2,387 reads
Recently, I answered a question by a person on Experts Exchange.com on how to find the # of weekdays between two dates. This question was simplified greatly by the fact that the dates given would always be from Monday to Friday, and so the calculations needed were very simple.Then, while looking at the recent scripts […]
2004-11-22 (first published: 2004-11-10)
129 reads
This Function and the query will generate the script for Create / Drop/ Create Constraint based on a Naming Convention . More changes can be done on this. This is very simple
2004-11-18 (first published: 2004-11-05)
211 reads
A better version of the :"Finding first/last day of month by a date"
2004-11-17 (first published: 2004-11-04)
139 reads
backup log with truncate only doesn't shrink the file. Actually truncating log needs transaction to truncate. A simple way to reduce the log file size to 1KB.
2004-11-16 (first published: 2004-11-03)
548 reads
create this SQL as a stored procedure and give user execute permissions on it store procedure. that user will be able to see all the jobs and their associated schedules but won't be able to modify, create or execute job. This is particularly a request most often aske dby developer to view jobs/schedules on production […]
2004-11-15 (first published: 2004-10-29)
632 reads
By Steve Jones
Fear is fueled by a lack of imagination. The antidote to fear is not...
The slidedeck and the SQL scripts for the session Indexing for Dummies can be...
By Chris Yates
Change is not a disruption in technology; it is the rhythm. New frameworks appear,...
We have a report that has multiple tables that list the top 15 performers...
We have a tool called DB Moto that reads journals (like t-logs) and replicates...
Comments posted to this topic are about the item Don't Forget About Financial Skills
The DBCC CHECKIDENT command is used when working with identity values. I have a table with 10 rows in it that looks like this:
TravelLogID CityID StartDate EndDate 1 1 2025-01-11 2025-01-16 2 2 2025-01-11 2025-01-16 3 3 2025-01-11 2025-01-16 4 4 2025-01-11 2025-01-16 5 5 2025-01-11 2025-01-16 6 6 2025-01-11 2025-01-16 7 7 2025-01-11 2025-01-16 8 8 2025-01-11 2025-01-16 9 9 2025-01-11 2025-01-16 10 10 2025-01-11 2025-01-16The docs for DBCC CHECKIDENT say this if I run with only the table parameter: "If the current identity value for a table is less than the maximum identity value stored in the identity column, it is reset using the maximum value in the identity column. " I run this code:
DELETE dbo.TravelLog WHERE TravelLogID >= 9 GO DBCC CHECKIDENT(TravelLog, RESEED) GO INSERT dbo.TravelLog ( CityID, StartDate, EndDate ) VALUES (4, '2025-09-14', '2025-09-17') GOWhat is the identity value for the new row inserted by the insert statement above? See possible answers