Although I never done it, none of my project ever need this, but 
attaching MSSQL db file should be easy. Because MSSQL already provide 
the way by a system stored procedure. Please check for "sp_attach_db" 
and "sp_attach_single_file_db". But I believe the file to be attached 
must reside on the same machine.

Btw, in MS SQL 2k you can always connect to master db. For it's 
guaranteed to be there, and available to each user (cmiiw).

So basically you must:
1. Create connection to master db
2. Use TADOStoredProc to execute either "sp_attach_single_file_db" or 
"sp_attach_db" system stored procedure after you gave proper 
parameters.

I believe the VB command for attaching database is nothing but a 
wrapper for the above steps (or maybe only for step 2).


Regards,
Luthfi B Hakim



--- In advanced_delphi@yahoogroups.com, "Sean 
Roberts" <[EMAIL PROTECTED]> wrote:
>
> Well, it occurs to me that if you can basic data from an existing 
SQL database, like the fields, types, indexes, etc., you could use 
that information in a SQL Exec statement which would just recreate 
those same tables on other SQL instances.
> 
> I'm not sure how easy it would be to get things like triggers and 
stored procedures, but I don't think it would be hard just to 
recreate tables...
> 
> I don't know of any existing commands or functions for this - I 
would have to do it through manual coding.


Reply via email to