Thursday, April 02, 2009

Attach database

In MsSQL, a database can attach with system stored procedure sp_attach_db. The simplest way to execute this stored procedure is with this syntax

EXEC sp_attach_db ‘databaseName’, ‘path/to/database/file’

Or if you want to attach more than 1 file use this syntax

EXEC sp_attach_db ‘databaseName’, ‘path/to/database/file/1’ [,‘path/to/database/file/2’] [,‘path/to/database/file/3’]


You can attach database file up to 16 files. The ‘path/to/database/file’ should no more than 260 characters long.

This stored procedure is a shortcut for creating a database with syntax

CREATE DATABASE databaseName ON (FILENAME = ‘/path/to/database/file/1’ [,FILENAME = ‘/path/to/database/file/2’] [FILENAME = ‘/path/to/database/file/3’] […FILENAME = ‘/path/to/database/file/16’]) FOR ATTACH

FOR ATTACH required all data files, and if multiple log files exists, they must be attach to

3 comments:

Anonymous said...

generic viagra india viagra generique viagra rx cialis super viagra sublingual viagra viva viagra song viagra without a prescription generic viagra cheap cheap viagra overnight viagra covered by insurance mexican viagra cheap viagra overnight alternative to viagra viagra jelly

Anonymous said...

[url=http://www.kfarbair.com][img]http://www.kfarbair.com/_images/_photos/photo_big8.jpg[/img][/url]

מלון [url=http://www.kfarbair.com]כפר בעיר[/url] - אינטימיות, [url=http://kfarbair.com/services.html]שקט[/url] . אנחנו מספקים שירותי אירוח מגוונים גם יש במקום שירות חדרים הכולל [url=http://www.kfarbair.com/eng/index.html]אחרוחות רומנטיות[/url] במחירים מיוחדים אשר מוגשות ישירות לחדרכם...

לפרטים נא גשו לעמוד המלון - [url=http://kfarbair.com]כפר בעיר[/url] [url=http://www.kfarbair.com/contact.html][img]http://www.kfarbair.com/_images/apixel.gif[/img][/url]

Anonymous said...

[url=http://sexrolikov.net.ua/tags/%CF%E5%F2%E5%E9/]Петей[/url] Смотри и дрочи : [url=http://sexrolikov.net.ua/tags/%C0%ED%E0%F2%EE%EB%FC%E5%E2%ED%E0/]Анатольевна[/url] , все это смотреть