Analyze a Table Contents
Analyze a table contents for type of information. Returns the number of distinct values for each field and the list and frequency of those values when specified
2005-03-22 (first published: 2005-03-04)
695 reads
Analyze a table contents for type of information. Returns the number of distinct values for each field and the list and frequency of those values when specified
2005-03-22 (first published: 2005-03-04)
695 reads
This script will show you how much diskspace can be reclaimed by shrinking all the logfiles of userdatabases using a DBCC SHRINKFILE(2) command. Often the spacegain is much smaller then expected. SQL Shrinks logfiles the end of the file until it finds the active part of the logfile. (If the active part of the logfile […]
2005-03-21 (first published: 2005-03-04)
433 reads
This stored procedure is created to be invoked (in my case by SQL Server scheduled job), and will then create a tracefile to a specified file location (ensure that if this is NOT local, your SQL Server Agent runs on a domain account that has access to that drive. The Stored procedure will create files […]
2005-03-16 (first published: 2005-03-04)
437 reads
This Procedure will display info regard to when the last time database was used. How to use it--------------Exec master.dbo.Sp_LastTimeDBUsed 'pubs'
2005-03-15 (first published: 2005-03-02)
1,062 reads
Easily extractss the complete stored procedure call hierarchy from "sysdepends" table of SQL Server and represent it in a pseudo-graphical tree-view.The script uses a temporary table (automatically created/dropped) to hold children and parents of relationships. For representing the call hierarchy the table contains a level field (depth) and a field containing the "enumerated path" (using […]
2005-03-14 (first published: 2005-03-01)
4,014 reads
/*--Objective : To Write a given string on to a given file--Created by: Helen--Date : Jan 4, 2005--Execution : SELECT * FROM DBO.Ufn_WriteToFile('D:\Testing\dbcc.TXT','Hello world')*/
2005-03-10 (first published: 2005-02-21)
581 reads
2005-03-09 (first published: 2005-02-21)
186 reads
Here's an alternate way of removing multiple white spaces by using the REPLACE command.
2005-03-08 (first published: 2005-02-22)
170 reads
This script will BCP all user tables of a database to individual files. The file names are tablenameyyyymmddhhmmss.dat To executeusp_bcp_out_alltables 'database','path','server'You will need to change your default 1) path2) server
2005-03-07 (first published: 2005-02-23)
281 reads
This script creates a table based function that returns time dimension that would typically be seen in a data warehouse. The time dimension has aggregate values for week, month, quarter, half, and year.
2005-03-04 (first published: 2005-02-23)
1,249 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,...
Why is sql doing a full scan VS seeking on the index? I've included...
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...
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