SQL Server Versions
12 years ago
in General
I have just found a very good website that lists the various version numbers for SQL Server. You can see from the list which services packs and updates have been applied.
http://www.sqlteam.com/article/sql-server-versions
List of database files
02 years ago
in Transact-SQL
The script below can be used to extract a list of databases along with the files associated with each database. The size (according to SQL Server) is also returned in pages and bytes.
USE master
GO
DECLARE @dbID INT
DECLARE @name VARCHAR(500)
DECLARE @sql VARCHAR(1000)
CREATE TABLE [...]
Save (Not Permitted) Dialog Box
02 years ago
in General
The Save (Not Permitted) dialog box warns you that saving changes is not permitted because the changes you have made require the listed tables to be dropped and re-created.
The following actions might require a table to be re-created:
Adding a new column to the middle of the table
Dropping a [...]
Cannot Connect To SQL Server Analysis Services 2008
02 years ago
Whenever I tried to connect to Analysis Services using the SQL Server Management Studio 2008, I was getting the following error:
Cannot connect to [Computer Name]\[Instance Name].
A connection cannot be made. Ensure that the server is running. (Microsoft.AnalysisServices.AdomdClient)
No connection [...]
Generate a list of tables for all databases on a server
02 years ago
in Transact-SQL
The following Transact-SQL can be used to generate a list of tables for all the databases on a server:
USE master
GO
DECLARE @dbID INT
DECLARE @name VARCHAR(500)
DECLARE @sql VARCHAR(1000)
CREATE TABLE #databasetables
( DatabaseID INT,
DatabaseName VARCHAR(100),
TableID INT,
TableName [...]
List of primary key fields within a database
02 years ago
in Transact-SQL
The query below lists the Table Name, Column Name, and Column ID for all Primary Key columns within a database
SELECT t.name AS TableName, c.name AS ColumnName, c.colid AS ColumnID
FROM sysindexes i
INNER JOIN sysobjects t
ON i.id = t.id
INNER JOIN sysindexkeys k
ON i.indid = [...]
List of foreign key relationships
02 years ago
in Transact-SQL
Use the query below to produce a list of foreign key relationships:
select f.name AS ReferencingTable, fc.name AS ReferencingColumn,
r.name AS ReferencedTable, rc.name AS ReferencedColumn
from sysreferences s
inner join sysobjects f on s.fkeyid = f.id
inner join sysobjects r on s.rkeyid = [...]
Error “HRESULT 0x800A03EC” when outputting data to Excel
23 years ago
in Excel
Sometime ago, I wrote a Query Tool application that output data from a database into Excel. However, in the past few days, the users have been getting the “HRESULT 0x800A03EC” exception error when running a specific query.
I knew that the application was working, because other query data was being [...]