SQL database rename

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 years ago
I renamed my sql db from the name created during the install process. I changed the name in the connection string but then had problems so I had to change it back. I wasn't sure where else the db name figures in the program.

What do I need to do to ensure a rename works ? (assuming you can rename it)
14 years ago
changing the database name in the web.config file does not change the name of the database - probably you won't be able to rename it on the hosted environment.

if it is important for you to do so, check your database provider to see if you can rename it (maybe you need to contact them to ask)

alternatively, backup your database, delete the existing one, create a new one with the name you want then run the backup file over it.
14 years ago
I'm only wanting to rename it on my local server during development, I want to develop a copy of the sql db and if it goes wrong point nopcom back to the existing db. Probably will have to copy over with the same name.

I'm really more concerned about uploading my developed site to my hosting site and then getting all the connections in place for nopcom to read the sql db.

I tried during the install connecting to an existing database and it didn't want to know.

I assume this is pretty straight forward otherwise you'd have to develop on the remote host in every case and I can't believe that's a requirement.

Any experience of doing this, anyone (or nopCommerce) ?
14 years ago
so you need to change the name of the database with your database management software (i use microsoft sql server management studio - but others are available)

then change the name in your connection string to this new name

in your hosted environment, the connection string will look different ( it will have a username and password)
14 years ago
OK thanks, I presume all sql changes should be done in the sql man studio. Obviously I was not using the right tool for this.
14 years ago
actually, visual studio and VWD  are quite useful for editing data in the database (but as far as i know, you cannot change the database name from there) - you need to creat a connection then you can open the tables and edit them directly.

I find it more straightforward to use VS 'publish to provider' option for scripting databases on my local machine before deploying (you can of course also copy a hosted database this way - easy way to backup)

After it's scripted, i use Management studio to run the script over the new database
14 years ago
On a hosted site....

  Depending on your host, you will most likely NOT be able to change the db name.

  There may be exceptions to this. And even if you can that unless you are fairly familiar with SQL server, it is not recommended as you can see the problems you may run into.

Create new, delete old.

Local site...

    sure, use management tools to rename.
14 years ago
OK thanks for the feedback guys. SQL management is not my territory so it's useful to know what you can and can't do before you go off tinkering in order to work the db out.
14 years ago
download the software and play around with it - its the best way to learn. www.asp.net has a lot of useful videos and turorials
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.