Friday, March 30, 2012
How to rename physical file name
db1_log.ldf, both locating on the same folder. I want to copy both the files
to db2.mdf, db2_log.ldf (in the same folder) and attach as DB2. I know the
commands to attach a database with different name. I want to know, how to
change db1.mdf to db2.mdf
TIA
J JustinJustin
I prefer RESTORE DATABASE from QA rather than EM. In the QA just before a
running change the names of the files
RESTORE DATABASE MyDatabase FROM DISK='C:\MyDatabase20050206.bak'
WITH RECOVERY,
MOVE MyDatabase_Data' TO 'C:\Program Files\Microsoft SQL
Server\MSSQL\Data\ChangeItHere.mdf',
MOVE MyDatabase _Log' TO 'C:\Program Files\Microsoft SQL
Server\MSSQL\Data\ChangeItHere_log.ldf'
"J Justin" <justin@.gjsoft.com> wrote in message
news:eRxy9uXdFHA.3184@.TK2MSFTNGP15.phx.gbl...
> I have a database, which consists of two physical files db1.mdf,
> db1_log.ldf, both locating on the same folder. I want to copy both the
files
> to db2.mdf, db2_log.ldf (in the same folder) and attach as DB2. I know the
> commands to attach a database with different name. I want to know, how to
> change db1.mdf to db2.mdf
> TIA
> J Justin
>|||Thanks for your quick reply. I don't have BAK file, rather I have the raw
mdf and ldf files. Is there any command now?
Regards
J Justin
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%233lXN0XdFHA.2688@.TK2MSFTNGP14.phx.gbl...
> Justin
> I prefer RESTORE DATABASE from QA rather than EM. In the QA just before a
> running change the names of the files
> RESTORE DATABASE MyDatabase FROM DISK='C:\MyDatabase20050206.bak'
> WITH RECOVERY,
> MOVE MyDatabase_Data' TO 'C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\ChangeItHere.mdf',
> MOVE MyDatabase _Log' TO 'C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\ChangeItHere_log.ldf'
>
>
> "J Justin" <justin@.gjsoft.com> wrote in message
> news:eRxy9uXdFHA.3184@.TK2MSFTNGP15.phx.gbl...
>> I have a database, which consists of two physical files db1.mdf,
>> db1_log.ldf, both locating on the same folder. I want to copy both the
> files
>> to db2.mdf, db2_log.ldf (in the same folder) and attach as DB2. I know
>> the
>> commands to attach a database with different name. I want to know, how to
>> change db1.mdf to db2.mdf
>> TIA
>> J Justin
>>
>|||No, after dettaching database rename the files manual .
"J Justin" <justin@.gjsoft.com> wrote in message
news:%23$K7r9XdFHA.1684@.TK2MSFTNGP09.phx.gbl...
> Thanks for your quick reply. I don't have BAK file, rather I have the raw
> mdf and ldf files. Is there any command now?
> Regards
> J Justin
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:%233lXN0XdFHA.2688@.TK2MSFTNGP14.phx.gbl...
> > Justin
> > I prefer RESTORE DATABASE from QA rather than EM. In the QA just before
a
> > running change the names of the files
> >
> > RESTORE DATABASE MyDatabase FROM DISK='C:\MyDatabase20050206.bak'
> > WITH RECOVERY,
> > MOVE MyDatabase_Data' TO 'C:\Program Files\Microsoft SQL
> > Server\MSSQL\Data\ChangeItHere.mdf',
> > MOVE MyDatabase _Log' TO 'C:\Program Files\Microsoft SQL
> > Server\MSSQL\Data\ChangeItHere_log.ldf'
> >
> >
> >
> >
> >
> > "J Justin" <justin@.gjsoft.com> wrote in message
> > news:eRxy9uXdFHA.3184@.TK2MSFTNGP15.phx.gbl...
> >> I have a database, which consists of two physical files db1.mdf,
> >> db1_log.ldf, both locating on the same folder. I want to copy both the
> > files
> >> to db2.mdf, db2_log.ldf (in the same folder) and attach as DB2. I know
> >> the
> >> commands to attach a database with different name. I want to know, how
to
> >> change db1.mdf to db2.mdf
> >>
> >> TIA
> >>
> >> J Justin
> >>
> >>
> >
> >
>
How to rename a file in SSIS
I want to rename a file that is a variable to a fixed file name in a specific folder in SQL Server System Integration Services using the File System Task Editor.
Example: File1.txt to Users.txt or File2 to Users.txt. The source file is a variable the destination file is not. Here is an example of the File System Task Editor
HOW DO I SPECIFY A FIXED OR VARIABLE FOLDER NAME WITH A SPECIFIC FILE NAME???
File System Task Editor
Properties Value
Destination Connection
IsDestinationPathVariable True
DestinationVariable User::ArchivePath
OverWriteDestination True
General
Name Rename a file
Description File System Task
Operation
Operation Rename file
Source Connection
IsSourcePathVariable True
SourceVariable User::ImportFilePath
Thanks
There is more than one way to do it, the last link is run by DTS/SSIS experts you will find most of what you need. Hope this helps.
http://blogs.conchango.com/jamiethomson/archive/2005/09/14/2149.aspx
http://msdn2.microsoft.com/en-us/library/ms140185.aspx
http://www.sqlis.com
Monday, March 26, 2012
How to remove a recursive relationship
I am building a db that contains folders with all info about a folder.
For example :
folder_id PK
folder_name
folder_size etc.
In my case, each folder may have 0 or more childern. A child itself
is unlikely going to have any children in itself. This is a recursive
relationship I'd like to remove in my DB design.
How can I represent this relatonship?
Thank you, DinoPlease elaborate on the issue, if you could. I'm not sure I understand; a
child folder which is the only child of another folder is unlikely to have
any children of its own?
How are you modelling the hierarchy itself? It doesn't HAVE to be recursive
(although that is one option). There are also hierarchical modelling
techniques like enumerated path and nested sets (search Google and you'll
get plenty of info on each) that are not recursive.
"Dino Buljubasic" <dino@.noplacelikehome.com> wrote in message
news:p2sj50p0pcihhqo9i4f0g0kv1thl98see7@.
4ax.com...
> Hi,
> I am building a db that contains folders with all info about a folder.
> For example :
> folder_id PK
> folder_name
> folder_size etc.
> In my case, each folder may have 0 or more childern. A child itself
> is unlikely going to have any children in itself. This is a recursive
> relationship I'd like to remove in my DB design.
> How can I represent this relatonship?
> Thank you, Dino|||Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.server:335813
I am gonna do it just like:
folder_id PK
parent_folder_id FK
folder_name
this way if the folder has a parent I will know it. I think this
solves the problem.
Thanks anyways,
Dino
On Thu, 18 Mar 2004 14:10:38 -0500, "Adam Machanic"
<amachanic@.air-worldwide.nospamallowed.com> wrote:
>Please elaborate on the issue, if you could. I'm not sure I understand; a
>child folder which is the only child of another folder is unlikely to have
>any children of its own?
>How are you modelling the hierarchy itself? It doesn't HAVE to be recursiv
e
>(although that is one option). There are also hierarchical modelling
>techniques like enumerated path and nested sets (search Google and you'll
>get plenty of info on each) that are not recursive.
>
>"Dino Buljubasic" <dino@.noplacelikehome.com> wrote in message
> news:p2sj50p0pcihhqo9i4f0g0kv1thl98see7@.
4ax.com...
>
How to reinitialize when "There is a problem with your selected data store"?
I've been trying to reinitialize the membership database, but something stops me.
I have tried deleting aspnetdb.mdf from the App_Data folder. This works fine, and then a new one is created when I use the asp.net adminstration tool. I can use the server explorer to view the table content (all null).
Although I can open the asp.net configuration page, the problem occurs when I select security. Then I get the error
There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.
The following message may help in diagnosing the problem:Database 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\asp.netwebadminfiles\App_Data\ASPNETDB.MDF' already exists. Could not attach file 'C:\Documents and Settings\Jeff Leese\My Documents\world\my work\current\counsellor\App_Data\ASPNETDB.MDF' as database 'ASPNETDB_devjeffleese'.
All this seems to have happened after I modified my connection info in the web.config file:
<connectionStrings>
<removename="LocalSqlServer"/>
<addname="LocalSqlServer"connectionString="Data Source=.\SQLEXPRESS; AttachDbFilename=|DataDirectory|\ASPNETDB.MDF; user instance=true; Integrated Security=True; Initial Catalog=ASPNETDB_devjeffleese;"
providerName="System.Data.SqlClient" />
</connectionStrings>
So, two questions:
1) What are the sections about? They seem to have been inserted automatically at some point, and I wonder if its just formatting info or should I remove them?
2) How can I get security going again. How do I deal with the 'already exists' problem that prevents 'attaching' ?
Would greatly appreciate guidance in how to start over...
Hi,
I had a similar problem with the install of the ASPNET DB, and I'll try to recall how I got it running.
What I tried first was to hae the DB istalled automatically from the WS I have running VS 2005, which is networked to a server running SQL Server 2005 (Standard). I wanted the DB installed on that SQL Server instance, but ran into problem. Even pre-creating the DB ther didn't seem to help. I'm not saying it can't be done, but it wasn't worth the effort to me. I DL'ed and installed an instance of SQL Server Express on the WS that has VS, did the aspnet_regsql.exe, and things worked Ok. I figure I can transfer the DB to the full SQL Server when/if I need to, but where it is is fine for development work. (Side note: I installed the Full version client tools on the WS, so I'd have these, rather than the Expess manager - but getting the uninstall/install sequence right was a hassle).
I didn't see a mention of aspnet_regsql.exe in your post. If you havent used it, do a search on msdn.microsoft.com for how and why to use it. You should find it in your Windows\Microsoft.net\Framework\(the version you are running). You should find it there, in the same place as the reg for IIS (if you need that too).
Good luck, hop eit helps. BRN..