Posts tagged Database
Detach, Move, and re-Attach database
01 year 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 [...]
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 [...]
List of primary key fields within a database
03 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 = [...]
MS Access – Remove “dbo_” prefix from imported tables
03 years ago
in Access
The procedure below, can be used to remove the “dbo_” prefix from all imported tables within a Microsoft Access Database.
Public Sub Remove_DBO_Prefix()
Dim obj As AccessObject
Dim dbs As Object
Set dbs = Application.CurrentData
'Search for open AccessObject objects in [...]