SQL Server
Table information – column lengths, counts and unique counts
11 month ago
in Transact-SQL
Hi.
The Transact-SQL script below returns the following information:
ID – Just an identity column used within the script
SchemaName – The name of the schema
TableName – Obviously, the name of the table
ColumnName
Type – The data type of the column
Length – The maximum number of bytes used by the [...]
Return the MAX of all dates within all tables within all databases
010 months ago
in General, Transact-SQL
I wanted to produce a list of the MAX of date fields (DateTime, SmallDateTime, TimeStamp) for all tables within all databases held in an instance of SQL Server.
The script below was written for SQL Server 2000, but should be easily customisable for SQL Server 2005
As always, please ensure you test [...]
Detach, Move, and re-Attach database
012 months ago
The Transact-SQL Script below, is useful if you want to standardise the location of your databases. I have been managing a server whereby databases created by other people were created all over the place!! Therefore, this script was written to make life so much easier.
Be sure to read through [...]
Maintenance Plan Error “Server: Msg 22029, Level 16, State 1, Line 0 sqlmaint.exe failed.”
11 year ago
in General
Earlier today, I discovered that the database maintenance plan on one of our SQL Server machine wasn’t working. When I reviewed the logs, it simply said “sqlmaint.exe failed”.
I ran the following command (copied from the SQL Server Agent job) using Query Analyzer (as this was a SQL Server 2000 [...]
Top most used query plans that are cached by SQL Server for faster query execution
01 year ago
in Transact-SQL
The query below, returns the top 20 most used query plans that are cached by SQL Server for faster query execution.
For more information regarding the dynamic management view, please see “sys.dm_exec_cached_plans (Transact-SQL)” in Books Online.
SELECT TOP 20
CASE cp.objtype
WHEN [...]
Do you want to execute a Stored Procedure as part of a SELECT statement??
01 year ago
in Transact-SQL
I was on a training course at the end of September, and came across a way to execute a simple stored procedure as part of a select statement using an Inline Table Valued Function.
You (like me) have probably tried to run the following statement expecting to get results from a stored procedure:
USE [...]
SQLBits – The 7 Wonders of SQL
01 year ago
in General
www.sqlbits.com
SQLBits – The 7 Wonders of SQL conference, is taking place from September 30th to October 2nd at York University.
SQLBits is the largest SQL Server conference in Europe and the previous six conferences have established it as a must-attend event for DBAs, developers and BI [...]
FREE Level 400 SQL Server Performance Monitoring and Tuning Webcasts
01 year ago
in General
FREE Level 400 SQL Server Performance Monitoring and Tuning Webcasts at
http://www.sqlworkshops.com/webcast
This is a great resource for performance monitoring and tuning