Posts tagged Database

Detach, Move, and re-Attach database

0
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

0
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

0
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

0
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 [...]

Move “tempdb” database

0
When SQL Server is installed, the “tempdb” database is placed by default, on the same drive that SQL Server is installed on. As this is usually the same drive as the operating system, it is best to move the “tempdb” database to a separate drive. To move the “tempdb” database to a separate drive to [...]
Go to Top