getting schema and data OUT OF SQL Server Compact into SQL Server LocalDB or SQL Anywhere (Sybase/SAP) - sql

I want to export the entire schema and daily data from a SQL Server Compact database (3.x) into a SQL Server LocalDB or Express database. Evem better yet would be to pipe it daily into a Sybase/SAP SQL Anywhere database.
I would like to grab the Compact schema and port it to the other database, then set up a daily pipe to copy the data completely into the second database.
Any experts out there who know how to do this? Are there data migration tools in SQL Server LocalDB / Express that can be automated to do this?
Even better yet, would be to have the database painter in Powerbuilder 12.5 (SAP/Sybase) be able to access the SQL Compact database....but I'm not going to hold my breath. Powerbuilder could then do the data pipe.
Any ideas?
Thank you in advance.

You can use my SQL Server Compact Tools on Codeplex to do this, either from GUI, coomad line or via a .NET API

Related

backing up sql database from microsoft sql server

i just want to ask if how can i backup my database from sql server 2005 using sql server management studio express? i want a backup it using sql file (.sql and not .bak or .mdf) from creating database (if not exist), tables and even the records on the table..thanks in advance :)
This is not possible with one command. You can script single objects, but I'm not aware of a way to do this in SSMS. We use SQL Compare from redgate here - it's pretty great.
You can try powershell.
Docs here.

complete sync between iphone sqlite3 database to sql server 2005 database on the server

I hava a sqlite3 database placed in the documents folder. I need to sync this database with the sql server 2005, which is running at our server.
Is there a possibility that i can do a Replication between a sqlite3 database and a MSSql server 2005.
Are you married to sqlite3? Because the short answer, to the best of my knowledge is not really- with 3 potential options:
I've heard of some savvy programmers having a bit of luck writing their own code either using delimited text or XML or the SqlClient provider for .NETCF to move data between the server and sqlite3 database.
You can do snapshot replication to any ODBC data source. But this might mean either copying your sqlite database to your server or finding another replication product which can go between SQLite and an ODBC desktop database.
The last option I can think of is to switch from sqlite3 to sql mobile edition / sqlce or sql express (depending on if this is a device or something else) as you would have the option to set up replication or RDA (remote data access) between the those databases and your ms sql server 2005 db- hence the question are you married to sqlite3?
Also- I just was reading about SQL Anywhere (ultralite) from Sybase which is a free solution. This little database has a pretty small footprint and also support MobiLink Synchronization Wizard which allows you to setup replication with your MS 2005 db. Here is a moderately useful article about MobiLink Synchronization.
if you decide to consider option 3 here are some articles to help set up RDA or Replication with your db's.
It's not plug-n-play but the Microsoft Sync Framework (http://msdn.microsoft.com/en-us/sync/bb736753) will do it.
I've downloaded and installed the iPhone to SQL Server sync sample and run it. It's actually pretty slick, Works great. It was just a basic test but perhaps it will help you.

Partial import of Sql server 2005 database for local developement

So at work, my team is using a central SQL server 2005 database server for integration testing and I want to move to testing on my local database. The only problem is that the central database is in excess of 10 Gb.
I am interested in importing the data objects and a rows for each table to ensure I can be up and running. Can you guys advise me on how I can do this?
I have VS 2008 professional and SQL Server management studio express. Would I need VS 2008 database edition?
Thanks
-Venu
EDIT : I will try logging into the central database server and seeing if the host machine has better tools. Thanks kpollock, I didn't think of that.
Both 2005 and 2008 Express editions have 4 gb limitation.
Have you thought about making a db copy on central server and dealing with it (just restore it into new db with other name)?
See also BACKUP and RESTORE in SQL Server -- Full Backups
Looks like an SSIS job to me - which I think Express version of Management Studio doesn't have.
Or you could do it in C# calling Stored procs on the source database to extract the data if that's where your skills lie. (this is how I would do it as I think it's more widely comprehensible - but that's just my opinion).
If the database is live and new data comes in all the time perhaps you could set up the schema and reference data only then use replication to get the new data as it comes in (if you think that will get you a representative sample).
You will have to code up the sample extraction based upon an understanding of the schema - i.e. ensure you get a full set of linked records (e.g detail records for orders and all lookups e.g. customer, addresses, etc.).

Restore SQL Server 2008 DB *to* SQL Server 2005

Got myself in a bit of a pickle here ... working on a CMS project, under the assumption that sql server 2008 was greenlighted as the db of choice. Well it wasn't, we now have to backport all of our content out SQL Server 2008 and into SQL Server 2005.
A simple backup/restore procedure yields: "RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3241)".
Unfortunately, exporting the data to an excel spreadsheet yields multiple OLE errors which I believe is actually a problem in the db of the cms.
Does anyone out there have other approaches they would like to recommend for this task? Thanks in advance
Use RedGate:
tool for comparing and deploying SQL Server database contents.
You can work with live databases, backups, or SQL scripts in source control. Damaged or missing data can be restored to a single row, without the need for a full database recovery.
SQL Data Compare helps you compare and deploy changes quickly, simply, and with zero errors...
There is no way to do this by default. You can generate scripts for 2008 database on 2008 server and then execute these scripts on 2005 version. Note that you’ll have to manually review scripts and remove all parts that are unique to 2008 version.
Another way is to use third party tools such as Red Gate or ApexSQL Diff (move schema) and ApexSQL Data Diff (move data).
Use the Generate SCripts to create the database and schema and ensure you target SQL Server 2005 and script data.
Rather than do a backup and restore you might try using SQL 2005's Import/Export Data wizard.
http://support.microsoft.com/default.aspx?scid=kb;en-us;314546
http://msdn.microsoft.com/en-us/library/ms140052(SQL.90).aspx
I've just hit the same problem and here is how I worked around it.
The problem was to copy a database from an operational SQL Server 2008 database to a new SQL Server 2005 database.
I scripted the database using Management Studio on the 2008 server. I only scripted the database design, not the data. I should add also that the DB only has tables and indexes, so I haven't tried this with any cleverer objects although I can't think why they wouldn't work.
On the 2005 server I created a new database by hand and then ran the script to set up all the tables and indexes.
The in Management Studio back on the 2008 server I used the Export Data wizard to export the data from the 2008 server to the 2005 server. It's currently running and seems quite happy moving the data.
Once all the data is across I'll have a couple of small things left to do - create the users and set-up the security in the 2005 DB, but all-in-all it doesn't look like a bad way of doing it. It's not quite point-and-click but it's not too strenuous.
So it seems that the Copy Database wizard won't work (I think because the package ultimately runs on the 2005 server and 2005 Management Studio can't talk to 2008) but the Export Data wizard is quite happy moving data ... as long as the DB already exists on the target server.
Hope that's useful.
It's not possible to restore to previous versions in SQL Server
Is there no SQL 2005 backup around? Otherwise you really are limited to export the entire database in 2008, and re-import back into 2005, or the Import/Export wizard in 2008
Or rely on 3rd party tools. e.g. Red Gate Data Compare is able to sync. the DATA between 2 servers/databases
I only use mysql but can you export your data into sql statments, and then import then into sql2005? Just a thought..
I faced a similar problem (sql 2005 to sql 2000), and found that I happened to have a blank database at the older version. I used bcp.exe to copy all the data.
check this link click here
You can create the database script in sql server 2008 and you can use it sql server 2005 and lower version....

Convert SQL Server Database from 2005 to 2000

We have a Microsoft SQL Server 2005 database that needs to be converted back to SQL Server 2000. Does anybody have any suggestions on the approach or tools I should use to perform this conversion? We don't utilise any SQL Server 2005 specific features in the database so this should not make the conversion problematic.
I should mention that I have found the Microsoft SQL Server Export facility very buggy in dealing with Auto Generated Keys so suggestions for alternative tools would be appreciated.
Generate a full script for your database in SQL2005, and change the "Script for Server Version" option to SQL Server 2000. You can now recreate your database on the SQL 2000 server. After this is complete, use the export data feature to export from SQL 2005 to SQL 2000.
Get a trial of RedGate SQL ToolBelt, then use:
SQL Compare to transfer the database
SQL Data Compare to transfer the data
Script out the entire database
Create a new SQL2000 database
Run the script on the new database
Import the data from the SQL2005 to the SQL2000 database (lots of ways to do this)
There probably is a tool somewhere that does all this for you, although I don't know how commonly this is done.
What you want to do is called downgrading. Google gives lots of results, but here's a good walkthrough on a thread of Microsoft's forums (scroll down near the bottom of the page).