Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
attach_database_without_log
CREATE DATABASE [funky_db]
ON ( NAME = funkydb_data, FILENAME = 'c:\sql\funkdata.mdf' )
LOG ON ( NAME = funkydb_log, FILENAME = 'c:\sql\funklog.ldf')
USE [funky_db]
GO
CREATE TABLE [funky_people] (firstName VARCHAR(64), surname VARCHAR(64), dateofbirth DATE, funkLevel INT)
INSERT INTO [funky_people] VALUES ('funk','master','1969-01-01',100)
SELECT *
FROM [funky_people]
--------------------------------------------------------------------------------------------------------------
USE [master]
GO
CREATE DATABASE [funky_db] ON
( FILENAME = N'C:\sql\funkdata.mdf' )
FOR ATTACH
GO
USE [master]
GO
EXEC sp_attach_single_file_db
@dbname='funky_db',
@physname=N'c:\sql\funkdata.mdf'
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.