Showing posts with label design. Show all posts
Showing posts with label design. Show all posts

Tuesday, March 20, 2012

rename a DB

By mistake I name a db something.com instead of something_com.
so now it won't let me do some design things. it already has data in it and
the export routine Urps because of the naming so I can not copy it over to
something_com.
is there a way to rename the sysdatabase to something_com?try...
use master
go
exec sp_renamedb 'something.com','something_com'
go
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net
"BJ Freeman" <bj_newsgroups@.free-man.net> wrote in message
news:%239xLXjjiDHA.2536@.TK2MSFTNGP10.phx.gbl...
> By mistake I name a db something.com instead of something_com.
> so now it won't let me do some design things. it already has data in it
and
> the export routine Urps because of the naming so I can not copy it over to
> something_com.
> is there a way to rename the sysdatabase to something_com?
>|||thanks. the only thing I had to-do, extra, was set the DB to single user.
could have used dboptions, but used the enterprise manager.
"oj" <nospam_ojngo@.home.com> wrote in message
news:uQmc9njiDHA.1456@.TK2MSFTNGP11.phx.gbl...
> try...
> use master
> go
> exec sp_renamedb 'something.com','something_com'
> go
>
> --
> -oj
> RAC v2.2 & QALite!
> http://www.rac4sql.net
>
> "BJ Freeman" <bj_newsgroups@.free-man.net> wrote in message
> news:%239xLXjjiDHA.2536@.TK2MSFTNGP10.phx.gbl...
> > By mistake I name a db something.com instead of something_com.
> > so now it won't let me do some design things. it already has data in it
> and
> > the export routine Urps because of the naming so I can not copy it over
to
> > something_com.
> > is there a way to rename the sysdatabase to something_com?
> >
> >
>|||then do...
use master
go
alter database [something.com] set single_user with rollback immediate
go
exec sp_renamedb 'something.com','something_com'
go
alter database [something_com] set multi_user with rollback immediate
go
--
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net
"BJ Freeman" <bj_newsgroups@.free-man.net> wrote in message
news:e7QmyHoiDHA.1692@.TK2MSFTNGP10.phx.gbl...
> thanks. the only thing I had to-do, extra, was set the DB to single user.
> could have used dboptions, but used the enterprise manager.
>
> "oj" <nospam_ojngo@.home.com> wrote in message
> news:uQmc9njiDHA.1456@.TK2MSFTNGP11.phx.gbl...
> > try...
> >
> > use master
> > go
> > exec sp_renamedb 'something.com','something_com'
> > go
> >
> >
> > --
> > -oj
> > RAC v2.2 & QALite!
> > http://www.rac4sql.net
> >
> >
> >
> > "BJ Freeman" <bj_newsgroups@.free-man.net> wrote in message
> > news:%239xLXjjiDHA.2536@.TK2MSFTNGP10.phx.gbl...
> > > By mistake I name a db something.com instead of something_com.
> > > so now it won't let me do some design things. it already has data in
it
> > and
> > > the export routine Urps because of the naming so I can not copy it
over
> to
> > > something_com.
> > > is there a way to rename the sysdatabase to something_com?
> > >
> > >
> >
> >
>|||An alternative method to oj's suggestion with SQL 2000 is ALTER DATABASE
... MODIFY NAME. This eliminates the separate steps to place the
database in single-user mode. However, exclusive database access is
still required. For example:
ALTER DATABASE MyDatabase
MODIFY NAME = MyNewDatabaseName
--
Hope this helps.
Dan Guzman
SQL Server MVP
--
SQL FAQ links (courtesy Neil Pike):
http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--
"BJ Freeman" <bj_newsgroups@.free-man.net> wrote in message
news:e7QmyHoiDHA.1692@.TK2MSFTNGP10.phx.gbl...
> thanks. the only thing I had to-do, extra, was set the DB to single
user.
> could have used dboptions, but used the enterprise manager.
>
> "oj" <nospam_ojngo@.home.com> wrote in message
> news:uQmc9njiDHA.1456@.TK2MSFTNGP11.phx.gbl...
> > try...
> >
> > use master
> > go
> > exec sp_renamedb 'something.com','something_com'
> > go
> >
> >
> > --
> > -oj
> > RAC v2.2 & QALite!
> > http://www.rac4sql.net
> >
> >
> >
> > "BJ Freeman" <bj_newsgroups@.free-man.net> wrote in message
> > news:%239xLXjjiDHA.2536@.TK2MSFTNGP10.phx.gbl...
> > > By mistake I name a db something.com instead of something_com.
> > > so now it won't let me do some design things. it already has data
in it
> > and
> > > the export routine Urps because of the naming so I can not copy it
over
> to
> > > something_com.
> > > is there a way to rename the sysdatabase to something_com?
> > >
> > >
> >
> >
>

Wednesday, March 7, 2012

Removing foreign keys

Hi everyone,

I've been using VS.NET to design and implement my SQL databases. This has been simple and effective.

I've deployed the database onto the production database server and it's been performing without a hitch for some time now.

My problem is that I now need to remove a foreign key relationship on the production database as I have had a relationship between two tables but now not wanting the relationship since the data that had the relationship is now not wanting to be compulsory. I've had a look in the system.foreignkey (I think) table but I can't make head or tail of it.

Long story short, how can I find and remove the relationship from Query Analyser / Enterprise Manager ? I know how to do this in VS.NET diagram (just delete the relationship) but when you open the production database in VS.NET the diagram is no longer there.

Any help will be appreciated!!

Thanks!
AndrewFixed - was browsing around in VS.NET on the server, right clicked on the table in question, and found the relationship tab, deleted relationship.

Thanks!
Andrew