Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 procedure to create DB

Author  Topic 

eugz
Posting Yak Master

210 Posts

Posted - 2007-05-04 : 15:02:27
Hi All.
I just start use SQL2005. I have code

CREATE DATABASE DMR_V3_0 ON
(FILENAME = 'X:\ABC\MYFILE_Data.mdf')
FOR ATTACH;

How to create procedure if value of FILENAME will specify before procedure will run.
Thanks.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-05 : 04:17:11
Why do you want to create database using procedure?
Create it whenever needed. I dont think you should have procedure until you want to create db dynamically

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sherlock_oz
Starting Member

12 Posts

Posted - 2007-05-06 : 19:49:50
I think you need to use a sql command object, then just pass in your database file name from a text box on your form.

Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-05-07 : 01:36:15
are you building your own app for managing SQL Server like SSMS? that's the only reason I can think of for executing code like this from an application.

which begs the question, why not just use SSMS?

If you want a web based app to manage SQL Server, there's this: http://www.microsoft.com/downloads/details.aspx?FamilyId=C039A798-C57A-419E-ACBC-2A332CB7F959&displaylang=en


www.elsasoft.org
Go to Top of Page
   

- Advertisement -