Showing posts with label express. Show all posts
Showing posts with label express. Show all posts

Thursday, March 29, 2012

Correct way to create indices? SQLServer Express 2005

Hi,

Apologies if this has been asked before, i've done a search but can't find a definitive answer.

I've created a table in an SQLExpress 2005 db using Server Managment Studio Express.

My intention is to use GUID fields as surrogate PK's. I therefore wanted to add a additional index to prevent duplicate records being added to the table. Not having used SQLServer before could someone confirm or deny that this is the correct way to do this. The PK field [EPISODEID{unique identifier}] is set as a non-clustered index. And i've created a second clustered index using the two fields that create a unique record. I've added a screen shot if that is any help.

Thanks

Chris

You can do that, yes. But I would normally leave the PK as the clustered index, since that should be how the majority of your records are located. If it isn't then you need to sit down and think what purpose your surrogate key is supposed to provide.

|||

Motley wrote:

You can do that, yes. But I would normally leave the PK as the clustered index, since that should be how the majority of your records are located. If it isn't then you need to sit down and think what purpose your surrogate key is supposed to provide.

Thanks very much for your replySmile [:)]

I've read up quite a lot of posts and articles regarding the use of surrogate vs natural keys. My primary reason for choosing surrogate keys is the inability to guarantee access to values which would create a natural key that didn't need changing. For example a head injured patient arrives at hospital and is assessed by the team i am working for. This is common as i work for critical care services which include Neurologically impared patients. They need a unique id for that patient but have no access to a possible natural key, the patients NHS number. In this case it's easier to generate a surrogate PK like a GUID which can be used on all the joins required in the database and use an incremental value from a store to replace the NHS number and keep the record unique until the NHS number can be assertained. Even then if the patient is non-uk resident they will never have an NHS number. However if the NHS number is found at a later date the PK can remain intact it's just a case of updating the NHS number field rather than cascading a changing PK through the database.

Anyways,

If i've got this correct the purpose of clustering an index is to create some form of sorting on sequentially related values which helps with retrieving records i.e. dates

If that's correct then as a surrogate key doesn't [or shouldn't] contain data relating to the contents of the record it indentifies it wouldn't matter if it is clustered or not. I think that this would particularly be the case with GUIDs as there is no logical sequence to their creation that would be worth clustering as compared to a sequential integer that might provide a pseudo order of entry index.

The second index i've created i've set as a clustered index as that is the one that holds the data which is used for retrieval i.e. finding all patient episodes within a given date range, so sorting would be beneficial and the unique index constraint should prevent duplication of records.

I've tried to follow the advice given on msdn regarding creating indicies i just wasn't sure if i'd actually done it correctly in Express05. Of course i may have missed the point entirelyEmbarrassed [:$]

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/createdb/cm_8_des_05_8185.asp

Thanks again

Chris.

Tuesday, March 27, 2012

Correct connection string for sql express2005 using VS2003

Hi,

I am using VS2003. I have installed .net2.0 so that I can run SQL Express. I am using XP Pro SP2.

My server is called ikitsch. The path to my database is

ikitsch\sqlexpress\Databases\Test1

I am using windows authentication. For some reason I can't seem to connect to the database. What would be a correct connection string to

connect to this database on my local machine?

Thanks

Hi

Take a look at http://www.connectionstrings.com/ for all kinds of connection strings.

Hope it helps.

|||Thanks a lot...one of ems gotta work!

copying website: database doesnt work?

Since VWD Express doesn't support Publish Website, I used 'Copy Website' to deploy my local site to the hosting server. The static page works fine, but when it gets to accessing database, I kept getting the following error:

An attempt to attach an auto-named database for file I:\Data\Web\dnh.sk\lingling_15726c71-b2bf-479f-bcc3-b7ae43318f3c\www\App_Data\Personal.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Anyone has the same experience? How to resolve this?

Thanks,

When you deploy your project, you have to upload your database separately.

You cannot use the db from the app_data folder. Execute the SQL against the db that you have in your hosting server and change the connectionstring for that.

Regards

|||

smiling4ever wrote:

When you deploy your project, you have to upload your database separately.

You cannot use the db from the app_data folder. Execute the SQL against the db that you have in your hosting server and change the connectionstring for that.

How do you do this when you only have VS.2005 and the basic SQL Express tools? Is it possible?

Sunday, March 25, 2012

copying tables from one database to another database

i am using visual web developer 2005 and SQL Express 2005 with VB as the code behind

i have two databases .

i want to copy all the tables with all the contents from one database to another database programatically

how to achieve this ?

please help me

easiest way is to use the detach - attach method or backup and restoresql

Copying tables from access to sql server express

I am trying to export a databse from access into sql server express. The access database is on a network and the sql server express is on my local machine.

Could someone give me setp by step instructions please as to how to export the data from the tables into my sql server express.

Thank you very much for your time

Access includes a wizard called the Upsize Wizard that can help you do this. Depending on which version of Access you have, it may be on different menus, but last time I saw it it was under Tools | Database Utilities.

You may have to install the Upsize Wizard if you don't already have the Advanced Wizards installed. Search the Access help file for information about using this tool.

Mike

copying tables from 2000 to 2005 express

I have a rather sizeable SQLServer 2000 database. To work on an issue, I would like to copy just a couple tables into SQL Server 2005 Express. How does one go about this efficiently?

I have a rather sizeable SQLServer 2000 database. To work on an issue, I would like to copy just a couple tables into SQL Server 2005 Express. How does one go about this efficiently?

Sorry, I should have mentioned that I have used DTS in SQLServer 2000 to copy from tables from one DB to another, but in SQL Server Management Studio Express (or in SQL Server Configuration Manager) I do not see any DTS-like tools available.

|||You are right, there are no tools for that. What about either doing a backup / restore on the databases OR do a manally SELECT INTO with using linked servers ? Another option would be to script the structure and then script the data from the table and execute the data script on the other server.


HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||I would like to do a SELECT INTO... but could you enlighten me on how to link servers?|||

Sure, but might have a look in the BOL about adding linked servers. In common if you don′t have the GUI to administer linked servers you can use the procedure sp_addlinkedserver and others around it, mentioned in the BOL.

If you are not sure about that, do not hesitate to come back. :-)

HTH, Jens Suessmeyer.


http://www.sqlserver2005.de|||I was hoping to get a bit more detail. Plus I do not understand what your last message was trying to communicate.|||

In case you're still looking, you can find a discussion of Linked Servers here. There are several links at the bottom of the topic that will take you to the specific topics on creating and using Linked Servers.

Mike

sql

Thursday, March 22, 2012

Copying Stored Procedures from one database to another

How do i copy Stored Procedures from one SQL Express database to another?

One way is, in Object Explorer (You do have SQL Server Management Studio Express, don't you), expand the Database, expand [Programability], expand [Stored Procedures], then right click on the stored procedure you want. One of the choices will be to [Script AS ...], choose [CREATE], then choose [File]. Save the file, copy the file, take to the other server, open it in Object Explorer, and then execute the file.

|||Thanks so much for your response Arnie. The part I'm confused about is importing it into the target database. I'm not sure how to do it...

I do use SQL Express Management Studio - from your explanation, I know how to export a stored procedure to a file. I'm unsure of how to import this file...
|||

Be sure to save the file with an extension of ".sql".

Then, in SSMSE, Click on [File], [Open], [File...] and navigate to and select your file. when it opens, then execute the code.

|||I'll just have to rename the database in the stored procedure to that of the target database, right? So executing it this way will cause the stored procedure to be copied over? Thanks again...

I have one last question...sorry to bother you...how do i export and import multiple stored procedures? I just noticed that there are over 30 SPs...doing this for each one would be time-consuming!!
|||Never mind - i figured out how to do that.

Right-click on source database>Tasks>Generate Script>

Select the source table, select Stored Procedures, then check the required stored procedures, finally save it in a single file with a .sql extension.

Open the file, rename the database to target database name, and execute.

Thanks again...
sql

Copying Stored Procedures from one database to another

How do i copy Stored Procedures from one SQL Express database to another?

One way is, in Object Explorer (You do have SQL Server Management Studio Express, don't you), expand the Database, expand [Programability], expand [Stored Procedures], then right click on the stored procedure you want. One of the choices will be to [Script AS ...], choose [CREATE], then choose [File]. Save the file, copy the file, take to the other server, open it in Object Explorer, and then execute the file.

|||Thanks so much for your response Arnie. The part I'm confused about is importing it into the target database. I'm not sure how to do it...

I do use SQL Express Management Studio - from your explanation, I know how to export a stored procedure to a file. I'm unsure of how to import this file...
|||

Be sure to save the file with an extension of ".sql".

Then, in SSMSE, Click on [File], [Open], [File...] and navigate to and select your file. when it opens, then execute the code.

|||I'll just have to rename the database in the stored procedure to that of the target database, right? So executing it this way will cause the stored procedure to be copied over? Thanks again...

I have one last question...sorry to bother you...how do i export and import multiple stored procedures? I just noticed that there are over 30 SPs...doing this for each one would be time-consuming!!
|||Never mind - i figured out how to do that.

Right-click on source database>Tasks>Generate Script>

Select the source table, select Stored Procedures, then check the required stored procedures, finally save it in a single file with a .sql extension.

Open the file, rename the database to target database name, and execute.

Thanks again...

Copying SqlServer database from web host

Hi,

I have a hard time copying my db (or instance?) from a SQL Server 2000 db which resides at my web host. I have Sql Server 2005 Express and Sql Server Management Studio Express on my computer and, well, there is no "ftp-like" option so I don't have a clue about how to proceed. I've read many posts on the net on this matter but nothing seems to apply to this, in my mind, rather common, configuration.

I have receieved Excel docs that should be appended to tables in my db. I have successfully installed DTS (seehttp://mobiledeveloper.wordpress.com/ for details - it's really simple but takes two hours) so I have a wizard for the actual import from Excel. My plan is now to

1. download/detach/whatever my table/db/part of the web host's db and download it to my computer. Then

2. fill the tables with the data from Excel. And finally, to

3. upload/attach/whatever my local db or table to the web host again.

I'm sooo confused, please, please help me out here!

Pettrer

Here's how:

http://forums.asp.net/1621926/ShowThread.aspx#1621926

copying sql table to computer hard drive

Hi,

I use sql server management express. I have created a table on my hosts remote database and i want to copy the table (or the data) in some format or other to my hard drive. does anyone have any good ideas how i may do this either through management express or other means.

thanks a lot

nick

http://www.cryer.co.uk/brian/sqlserver/howtoexportcsv.htm
http://www.codeproject.com/aspnet/ImportExportCSV.asp

|||

thanks mike, i shall give this a whirl

nick

Wednesday, March 7, 2012

Copying a single database table from VWDE to SQL server management express

Hello,

As the heading states, I'd like to copy a database table from VWDE over to SQL SME, where it'll replace its namesake. I've tried the 'attach' method but was denied due to server permissions. Is there another way of doing this, or will I have to delete the database and then run a script to reinstate (annoyingly convoluted)? This would be so much easier if the host supported SQL 2005 Express.

Thanks in advance

Hi,

The only way to attach a .mdf file to a SQL Server instance is to use the attach option in the Management Studio or call sp_attach_db stored procedure.

So I suggest you get proper permission in the database then try again.

HTH. If this does not answer your question, please feel free to mark the post as Not Answered and reply. Thank you!

|||

Hello Kevin,

Thanks for the reply; I'm sure what you suggest will work, as I had intended to use the attach method were it not for the permissions problem. Unfortunately there doesn't seem to be a way around this problem. When connecting to SQL 2000 using SQL Studio, a complete list of all databases on the server is visible. Clearly the permissions are in place to stop people accessing the wrong database. To attach a database, one must right click on 'database'; however access is denied at this point. A headache indeed.

Thanks

Saturday, February 25, 2012

Copying a database to another server

Im running SQL Server 2005 Express with SQL Server Management studio installed on my laptop. After updating my database, how do I copy the entire contents to the main server in the office, which is running windows server 2003 and SQL Server 2000 Developer Edition.
And is it possible to do it all from my laptop?

right click the database an you will see a context menu. on one of the sub menus here you will see generate script. In the wizard, one of the options is to specify sql 200 compatible

After running the script on the office server, right click on the database, select export, follow the steps in the wizard to export the data.

copying a database in the same SQLserver instance

Hi

Im using SQL server express and Management studio express, and i have a database attached called database1.

Now i would like to have an exact copy of this database, named database2.

I would only need the tables, and not the data in them, is there somehow i can do this?

There is no copy button in managment studio...

Create a new database called Database2, make Script of the database1 and open a query analyser window, change the database in the dropdown combo to datbase 2 (or run Use database2) and run the script

Steps to script database

(a) Right Click on DB

(b) Tasks Generate SQL Script and follow the instruction. You will get script without data.

Madhu

|||

Thank you for that..

I have no idea what it did with those scripts and such, but it made a perfect copy like i wanted..

Friday, February 24, 2012

'Copy Website' function in VS 2005 updates or overwrites Database?

I have a sql 2005 express database uploaded to my website with important information in it.

Now, I had to make some table change and need to update the online database.

I am not sure if the 'Copy Website' function in Visual Studio 2005 will update the database structure and data or will simply overwrite it.

Does anybody know the answer? If it overwrites it, would you please point me to information on how can I update the database structure and data without ruining it?

Thanks.

The system will over right as the moderfications will have been done in the local copy of the database... ie in the APP_Data.. (I am thinking that this is your case). If you only wanted to change the database schema and such one way would have been to create a database project and script out the changes as you were making them. Then you could have run the script against the old database.

Going forward you might have to copy down the database from the production system... Copy your web site project to the production system then import the old data into the new database structure on the server. Or you might be able to find some scripts to compare the databases and generate the scripts required to make the change in the production system.

|||Thanks Glenn!

Copy VS Create

Hello,

We are building a smart client that ships with it an offline db - Sql Express.

I wanted to check if there is a preferred/recommended approach to deploy the database ? I'm essentially asking between

1. Copying a database file and

2. Creating the database file by connecting to Master and issueing create database etc and then running the scripts as we need it.

Any help will be great,

Thanks,

Avinash

PS: The app is a multi user app and may be used by multiple windows users on the same machine. So we currently use the Auto Attach feature in the connection string with database files in the Special Application/User Data folder. So we isolate files b/w users.

Could you clarify your definition of "offline data" with your comment that this is a multi-user application? Do you expect multiple people to be using the same database simultaneously or should each user have a separate offline database?

Thanks for the additional informaiton.

Mike - SQL Express team

|||Hello Mike,

Its a multi user application in that - several windows users may use the application installled on one machine. Not at the same time. Currently we have one copy of the database per windows user logging into the machine/application in the User Data special folder.

So, yes its one database file per user but many such files may exist on a machine one per user. And only one user may use the machine/application at a time. However this may be slightly different in a WTS - terminal service environment. But even then the idea of one offline database file per user will not change.

Any advise will be appreciated and will help a lot..
Thanks,
Avinash
|||

Hi Avinash,

Thanks for the additional information. Since you are really looking for each user to have a unique database, I would embed the database into your application and then use User Instances to handle the attach/detach of the database. User Instances are new in SQL Express and are used by VS 2005 when you insert a database into your applciation. Check out the User Instance white paper for more information.

One of the main benefits of User Instances is that the person running the application doesn't have to be an admin user or have sa permissions to deal with things like attach and detach. Normally a user must have elevated permissions to do things such as this.

Once you've embedded a database in your application, you can also use ClickOnce deployment to get your application to your users. You should be able to find out more about ClickOnce in the VS documentation.

Regards,

Mike Wachal
SQL Express team

|||

Hello Mike Wachal,

One last question - if we generate the database file on a particular version of ms sql express and in time to come if there are a few more versions of ms sql express out there with the users - if we continue to package with our app a database file from an older version of sql express will that be a problem with users running a newer version of sql express ?

Also what about the converse scenario - where we ship a database file from a newer version of sql while the customer is still running on an older version.

Thanks,

Avinash

Friday, February 17, 2012

Copy table and/or records from SQL Server 2000 to 2005 Express

How can I copy a table from my sql server 2000 db to my sql server 2005 express edition?

I have a project in VS.NET 2005 and I have a db in App_Data folder. However, when I look into that folder, there is nothing visible. I now need to copy a table from my existing sql server 2000 to my db located in my project's App_Data folder.

Any help would be appreciated..

Regards,

You can use the DTS to do that.

Also, use the SQL managment Studio (enterprise manager in sql 2000) to manipulate MSSQL 2005

http://www.microsoft.com/downloads/details.aspx?FamilyID=82afbd59-57a4-455e-a2d6-1d4c98d40f6e&DisplayLang=en

Regards

Copy Stored Procedures from one server to another

I am moving a database from SQL Server 2005 to SQL Server 2005 Express
running on a laptop for a demo. I have the database tables and data copied,
but am unable to copy the stored procedures. How do I do this?
Thanks,
Mike Ober.You can either use dts and the copy objects or use
a script like this:
generate script for stored procedures in dependency order
http://www.eggheadcafe.com/articles/20030609.asp
--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>|||The fastest way would be to detach the database copy the mdf and ldf files
to the laptop and attach them there.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>|||Hi,
Take a look into the below URL; this talks about lots of options.
http://www.karaszi.com/SQLServer/info_generate_script.asp
Thanks
Hari
"Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>running on a laptop for a demo. I have the database tables and data
>copied, but am unable to copy the stored procedures. How do I do this?
> Thanks,
> Mike Ober.
>|||Hi
Open them in enterprise manager then "cut and paste" them to notepad
files.
Hope this helps
The Grand Master Programmer
Hari Prasad wrote:
> Hi,
> Take a look into the below URL; this talks about lots of options.
> http://www.karaszi.com/SQLServer/info_generate_script.asp
> Thanks
> Hari
>
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
> >I am moving a database from SQL Server 2005 to SQL Server 2005 Express
> >running on a laptop for a demo. I have the database tables and data
> >copied, but am unable to copy the stored procedures. How do I do this?
> >
> > Thanks,
> > Mike Ober.
> >
> >|||That worked - I had to delete and recreate the service account on the
laptop, but that wasn't a big deal.
Thanks,
Mike.
"Roger Wolter[MSFT]" <rwolter@.online.microsoft.com> wrote in message
news:%23CJI9xn5GHA.2524@.TK2MSFTNGP06.phx.gbl...
> The fastest way would be to detach the database copy the mdf and ldf files
> to the laptop and attach them there.
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>>running on a laptop for a demo. I have the database tables and data
>>copied, but am unable to copy the stored procedures. How do I do this?
>> Thanks,
>> Mike Ober.
>>
>|||Robbe,
Thanks for the link to the adonet source code generator.
Mike Ober.
"Robbe Morris [C# MVP]" <joeblow@.joe.com> wrote in message
news:%23Ay1FQn5GHA.2292@.TK2MSFTNGP04.phx.gbl...
> You can either use dts and the copy objects or use
> a script like this:
> generate script for stored procedures in dependency order
> http://www.eggheadcafe.com/articles/20030609.asp
> --
> Robbe Morris - 2004-2006 Microsoft MVP C#
> I've mapped the database to .NET class properties and methods to
> implement an multi-layered object oriented environment for your
> data access layer. Thus, you should rarely ever have to type the words
> SqlCommand, SqlDataAdapter, or SqlConnection again.
> http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp
>
>
> "Michael D. Ober" <obermd.@..alum.mit.edu.nospam> wrote in message
> news:uLhtJJn5GHA.3808@.TK2MSFTNGP06.phx.gbl...
>>I am moving a database from SQL Server 2005 to SQL Server 2005 Express
>>running on a laptop for a demo. I have the database tables and data
>>copied, but am unable to copy the stored procedures. How do I do this?
>> Thanks,
>> Mike Ober.
>>
>

Monday, February 13, 2012

Copy Sql Server Reports to Flash Drive

Hi- What do I have to copy to my flash drive to transfer reports from home to work? I am using Sql Server Express w/ advanced services.

Yes, I'm new to this, but learning. Thanks in advance!

JP

You'll need the RDL files and the data source file if using a shared data source.

Copy SQL Server 2005 Express database to SQL Server 2000

I think the easiest solution is to go to Properties|Options for the database
and change the compatibility level to (80) Sql Server 2000 then backup the
database and restore it to the new 2000 server.
Regards,
Dave Patrick ...Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
"Angus" wrote:
> Hello
> I have a copy of a SQL Server 2005 Express database - the mdf and .ldf
> files. If I copy to my machine and in the Enterprise manager try to
> attach
> the files I get error 602 - and apparently you cannot do this as the
> database structure has changed so much.
> Bearing in mind SQL Server 2005 is customersw so don't really want to
> install too much software on their machine. so if I can do this all my
> end
> that would be preferable. Can I somehow convert the 2005 database to run
> on
> my SQL Server 2000? What would I need to install on my machine to achieve
> this? The SQL Server 2005 Express does not seem to provide much in the
> way
> of data export etc.
> Angus
>
Dave Patrick (DSPatrick@.nospam.gmail.com) writes:
> I think the easiest solution is to go to Properties|Options for the
> database and change the compatibility level to (80) Sql Server 2000 then
> backup the database and restore it to the new 2000 server.
No, this does not work. The compatitibility level only affects how T-SQL
code is parsed and behaves. It has nothing to do with the on-disk structure
for the database.
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
|||Oops, Ok thanks for clarification Erland.
Regards,
Dave Patrick ...Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
"Erland Sommarskog" wrote:
> No, this does not work. The compatitibility level only affects how T-SQL
> code is parsed and behaves. It has nothing to do with the on-disk
> structure
> for the database.
>
> --
> 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

Copy SQL Server 2005 Express database to SQL Server 2000

Angus (nospam@.gmail.com) writes:
> I have a copy of a SQL Server 2005 Express database - the mdf and .ldf
> files. If I copy to my machine and in the Enterprise manager try to
> attach the files I get error 602 - and apparently you cannot do this as
> the database structure has changed so much.
> Bearing in mind SQL Server 2005 is customersw so don't really want to
> install too much software on their machine. so if I can do this all my
> end that would be preferable. Can I somehow convert the 2005 database
> to run on my SQL Server 2000? What would I need to install on my
> machine to achieve this? The SQL Server 2005 Express does not seem to
> provide much in the way of data export etc.
There is a fair chance that the database uses features that are not
available in SQL 2000, so a transfer to SQL 2000 is non-trivial, at least
a priori.
If you think that SQL Express does not cut it for you, I would suggest
that you cough up the 50 USD or similar for a license of Developer Edition
of SQL 2005.
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
The solution is not to "cough up" money for SQL 2005. What if someone else
reads this and needs to deploy to 2000 on a customer's server?
Do this:
In Management Studio, right-click on the Database, goto Tasks->Back Up
Back up to Disk,
Add path where file should go.
In Enterprise Manager, add a new database.
Highlight the database.
go to Tools -> Restore Database
Restore From device
Click Select Devices
Restore from disk, Add .bak file from Management Studio
Make sure paths at Options -> Restore As are correct
"Erland Sommarskog" wrote:

> Angus (nospam@.gmail.com) writes:
> There is a fair chance that the database uses features that are not
> available in SQL 2000, so a transfer to SQL 2000 is non-trivial, at least
> a priori.
> If you think that SQL Express does not cut it for you, I would suggest
> that you cough up the 50 USD or similar for a license of Developer Edition
> of SQL 2005.
>
> --
> 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
>
|||Shiggity (Shiggity@.discussions.microsoft.com) writes:
> The solution is not to "cough up" money for SQL 2005. What if someone
> else reads this and needs to deploy to 2000 on a customer's server?
> Do this:
> In Management Studio, right-click on the Database, goto Tasks->Back Up
> Back up to Disk,
> Add path where file should go.
> In Enterprise Manager, add a new database.
> Highlight the database.
> go to Tools -> Restore Database
> Restore From device
> Click Select Devices
> Restore from disk, Add .bak file from Management Studio
> Make sure paths at Options -> Restore As are correct
Not sure what you mean to say here, but if the intention is to describe
how to copy a database from SQL 2005 to SQL 2000, I'm afraid that you
method will not work. If you need to do that, you will have to script
the database (there is a SQL 2000 compatibility switch in the scripting
wizard) and bulk-copy data over. If database uses features that are not
supported on SQL 2000, you will have deal with that.
In the original post, Angus wanted to be able to work with a copy of
a customer database in SQL 2000. To that aim, he needs SQL 2005. And
if Express does not have what he needs, Developer Edition is his best bet.
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