all groups > sql server msde > november 2006 >
You're in the

sql server msde

group:

export tables from SQL Server to external drive and linking


export tables from SQL Server to external drive and linking Raj
11/22/2006 5:27:01 AM
sql server msde:
I hope this is the correct group for this question, if not I hope someone can
direct me to the correct one..
I have a co-working that is running Sql Server on a desktop and she has 3
tables that are extremely large. The files are so large she has no disk
space let to work, At the current time it is not possible to replace the
internal drive. She has a 320gig external drive that she wants to move these
tables and then link to them to run her queries.
Is this something that is possible in Sql Server?
Thanks
Re: export tables from SQL Server to external drive and linking Andrea Montanari
11/23/2006 12:00:00 AM
hi,
[quoted text, click to view]

you can detach the database via sp_detach_db system stored procedure
(http://msdn2.microsoft.com/en-us/library/ms188031.aspx), move the relative
database files to the external drive and reattach the database via CREATE
DATABASE ... FOR ATTACH; statement
(http://msdn2.microsoft.com/en-us/library/ms176061.aspx) like
USE [master]
GO
CREATE DATABASE [Raj] ON
( FILENAME = N'C:\Program Files\Microsoft SQL
Server\MSSQL.3\MSSQL\Data\Raj.mdf' ),
( FILENAME = N'C:\Program Files\Microsoft SQL
Server\MSSQL.3\MSSQL\Data\Raj_log.LDF' )
FOR ATTACH
GO
where you obviously modify the path to the external drive...

please keep in mind that you always have to detach the database(s) before
removing the external drive to prevent database corruptions so that it
becomes suspect and unavailable...
you obviously can incur in security problems (database loss in case of hot
drive removing) and reduced performances becouse of the limited I/O speed of
external drives (like USB2 and the like, that provide limited transfer
rates)....
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz http://italy.mvps.org
DbaMgr2k ver 0.20.0 - DbaMgr ver 0.64.0 and further SQL Tools
--------- remove DMO to reply

Re: export tables from SQL Server to external drive and linking Raj
11/23/2006 6:07:01 PM
Andrea ,
thank you for the help.. I will pass long this information.
Raj


[quoted text, click to view]
AddThis Social Bookmark Button