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.
| Author |
Topic |
|
MGA
Starting Member
28 Posts |
Posted - 2010-05-25 : 12:10:58
|
| i have the following proc that attach a database with the mdf and log files the question is how to replace the file path 'c:\R_Data.mdf' and 'c:\R_log.ldf' with the passed parameters @mdffile and @logfile pathescreate proc attachdatabase(@mdffile varchar(60),@logfile varchar(50))asbegin CREATE DATABASE MyAdventureWorks ON (FILENAME = 'C:\R_Data.mdf'), (FILENAME = 'C:\R_Log.ldf') FOR ATTACHendgo |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-05-25 : 12:24:48
|
| One way is use the dynamic sql:You can use "Exec" command or Sp_executeSQL command but please check the below article for more detailed info and issues with dynamic sql.http://www.sommarskog.se/dynamic_sql.htmlRegards,BohraI am here to learn from Masters and help new bees in learning. |
 |
|
|
|
|
|