You are here: Re: Change Logical Name in Script « MsSQL Server « IT news, forums, messages
Re: Change Logical Name in Script

Posted by Ryan on 08/10/06 12:42

Thanks Erland. I'll give it a try. No major issue on not using the
create script, but thanks for the advice on that.

Ryan

Erland Sommarskog wrote:
> Ryan (ryanofford@hotmail.com) writes:
> > I'm trying to restore about 70 databases onto a new SQL server and
> > wanted to script the creation and restore. I've done the creation with
> > no problems, but on the restore, the logical names (of the original
> > data) are all over the place and were historically wrong.
>
> If I understand this correctly, you first run CREATE DATABASE for a
> database, and then RESTORE for the same database for you. I've bad news
> for you: the script for CREATE DATABASE was in vein. RESTORE will create
> the database if it does not exist. And if it exists, it will throw the
> old one away.
>
> > So, even though I've been neat creating the database, it gets
> > overwritten with the odl rubbish name. How can I change the logical
> > name so that I can have a nice and neat naming convention ?
>
> ALTER DATBASE db MODIFY FILE oldname NAME = oldname, NEWNAME = newname
>
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
>
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация