What are the alternatives to TableDiff utility on SQL Server 2008? - sql

Currently we are using the TableDiff utility during an SSIS data load to update a live table in production from a staging table (which has the latest data to be updated - could be insert/update/delete).
But TableDiff takes quite a bit of time to identify differences and create the sql scripts for the job to use to update (from few hours - to indentify about a few 1000s of rows of updates to few 100,000s of rows of updates taking up to a few days).
Are there any better alternatives to TableDiff utility on SQL Server 2008 or maybe better processes/ideas?
Update:
Looking for both product/utility options as well as better algorithms to make it faster

Why calling a stored procedure with a MERGE statement in it is not an option here? I was using this approach in my DTS days.

I'd suggest Red-Gate's SQL Data Compare but it's a bit pricey. (there's a free trial if you want to check it out if it works for you)

RedGate supposedly is the best.
I sometimes use Atlantis tools
They are quite heavy, but do their job

Related

what method is the most used and efficient to copy "database schema" to other servers not the db!

servers all sql server 2008, and win xp
i have the following task
create a huge database, DONE
distribute it to the 20 waiting servers!!
if there were two or three i would have taken the trouble of creating the db's on all of using sql server managemnt stdio
but i am guessing that there is an efficient way
please note,
only the copy of the database structure, the schema is needed not the values within the cells!
thank you

			
				
Or of course you should have been creating the scripts as you went along and putting them in Source control. Then you would have exactly which scripts you needed for this version of the software and be used to doing the same thing for later modifications. You would also script the data inserts for any lookup tables you need to build.
Not having that, you can script the entire database. or use a SQL compare tool. But I strongly urge you to start treating database code like all other code and scripting, storing it in source control and versioning it. Life is so much better when you do that.
What Gabriel McAdams has shown, or, Redgate SQL Compare does this very nicely also.
If you can spare the moolah, using a tool like Red Gate's SQL Packager is an option i have used in the past and it works well!
The tool can do a lot more as well and may not be worth the spend though if you do not need the other features!
In that case, Gabriels'option above is definitely the easiest one to go with!

SQL SERVER 2005

how to update database structure using script?
I have old db in one server and new db in another server, I have to update the old db structure with new one. Can we do using script?
Please any one help me
Thank you.
There are really great tools that do this. Sql Compare from Red Gate is excellent and I've used it often to do this kind of thing.
SQL Compare is the industry-standard
tool for comparing and synchronizing
SQL Server database schemas. It's used
by over 200,000 developers, DBAs and
test engineers worldwide because it's
easy to use, it's fast, and it saves
time.
Whether you are working with live
databases, database snapshots, object
SQL scripts under source control or an
earlier backup, SQL Compare will help
you compare and synchronize database
changes quickly, simply and with zero
errors.
Read the whitepaper on database
development and discover how SQL
Compare can save you astonishing
amounts of time, whatever development
model your team prefers to use. SQL
Compare ensures accurate, fast results
with maximum end-user
You'll need some sort of structure comparison tool.
There are many on the market (none built-in), my personal favorite is SQL Delta:
http://www.sqldelta.com/
It enables both Structure comparison (and update scripting) and data comparison and scripting, with both possible from the command-line. (and it's quite cheap).

Powerful tools for creating SQL queries

I'm looking for a tool, which would help creating complex SQL queries. Sometimes it's difficult to even verify, whether the results of a query are correct. It's especially easy to get queries joining several tables to return too little or too much data.
The tool should enable at least creation of test tables, some kind of visualization how the queries gather their data and hopefully give better parsing of error cases than for example Oracle does.
Are there tools like this or do I have to stick with creating test tables manually, filling them with test data and commiting all kinds of queries with SQuirrel SQL?
When you have a very complex query it is usually easiest to validate by breaking it up into multiple queries that populate temp tables. These intermediary results can be individually verified and then you bring them together to produce the final result set. Depending on performance needs you can stick with the temp table approach or you can then rewrite to a single statement. Typically when I have a huge query it is for background processing so I stick with the temp table approach.
What RDBMS are you using? All of the major ones have some type of console available (e.g.-SSMS in SQL Server, Toad in Oracle, MySQL Query Browser/Administrator for MySQL, etc.), and they all have Query Execution Plans where you can see how the query will actually run. So, the answer to your question is that it's entirely dependent on what RDBMS you're using, but the safe bet answer is: Yes.
I recommend trying SQL Server 2008 Management Studio Express (SSMSE) if you are working with SQL Server. I have used it at work and I believe it does everything you are looking for.
You can get it and SQL Server (express editions) here.
Certainly not a free, open-source solution, but I believe Quest Software's TOAD will fit your requirements. Quest seems to offer alot of tools in that space...they have tools for modeling and analysis, however I've never used the modeler or analyzer.
I personally have experience with the commercial version of TOAD for Oracle. It's GUI is overwhelming at first, but after you mentally filter out all of the extra buttons that you'll never use, it's manageable.

What is best tool to compare two SQL Server databases (schema and data)? [duplicate]

This question already has answers here:
What is a free tool to compare two SQL Server Databases? [closed]
(7 answers)
Closed 3 years ago.
I would like to compare two SQL Server databases including schema (table structure) and data in tables too. What is best tool to do this?
I use schema and data comparison functionality built into the latest version Microsoft Visual Studio 2015 Community Edition (Free) or Professional / Premium / Ultimate edition. Works like a charm!
http://channel9.msdn.com/Events/Visual-Studio/Launch-2013/VS108
Red-Gate's SQL data comparison tool is my second alternative:
(source: spaanjaars.com)
http://www.red-gate.com/products/sql-development/sql-compare/
http://www.red-gate.com/products/sql-development/sql-data-compare/
I like Open DBDiff.
While not the most complete tool, it works great, it's free, and it's very easy to use.
I am using Red-Gate's software:
http://www.red-gate.com
SQL Admin Studio from http://www.simego.com/Products/SQL-Admin-Studio is now free, lets you manage your SQL Database, SQL Compare and Synchronise, Data Compare and Synchronise and much more. Also supports SQL Azure and some MySQL Support too.
[UPDATE: Yes I am the Author of the above program, as it's now Free I just wanted to Share it with the community]
I'm partial to AdeptSQL. It's clean and intuitive and it DOESN'T have the one feature that scares the hell out of me on a lot of similar programs. One giant button that it you push it will automatically synchronize EVERYTHING without so much as a by-your-leave. If you want to sync the changes you have to do it yourself and I like that.
There is one tool with source code available at
http://www.codeproject.com/Articles/205011/SQL-Server-Database-Comparison-Tool
That should give flexibility as code is available.
dbghost is the best i have used to date. one of the best features i have seen is that it will generate SQL code to go between versions of a database based on the SQL you keep in source control, as well as a database. simple and easy to use.
I've used SQL Delta before (http://www.sqldelta.com/), it's really good. Not free however, not sure how prices compare to Red-Gates
Try DBComparer, it's free and fast:
http://dbcomparer.com/
Database Workbench can made it too
http://www.upscene.com/products.dbw.index.php
Cross database development
Use the Schema Compare and Migration
Tools to compare testing and deployed
databases, migrate existing databases
to different database systems.
you can also made it with database Comparer
http://www.clevercomponents.com/products/dbcomparer/dbcomparer.asp
I use it for Firebird and it works well.
Try dbForge Data Compare for SQL Server. It can compare and sync any databases, even very large ones. Quick, easy, always delivers a correct result.
Try it on your database and comment upon the product.
We can recommend you a reliable SQL comparison tool that offer 3 time’s faster comparison and synchronization of table data in your SQL Server databases. It's dbForge Data Compare for SQL Server and dbForge Schema Compare for SQL Server
Main advantages:
Speedier comparison and synchronization of large databases
Support of native SQL Server backups
Custom mapping of tables, columns, and schemas
Multiple options to tune your comparison and synchronization
Generating comparison and synchronization reports
Plus free 30-day trial and risk-free purchase with 30-day money back guarantee.
We are using an inhouse developed solution that is basicly a procedure with arguments of what you want included in the comparision (SP's, Full SP code, table structure, defaults, indices, triggers.. etc)
Depending on your needs and budget, it might be a good way to go for you as well.
It is quite easily developed as well, then we just redirect output of procedure to textfiles and do text comparisions between the files.
One good thing about it is that its possible to save the output in source control.
/B
I've used Red Gate's tools and they are superb.
However, if you can't spend any money you could try Open DBDiff to compare schemas.
I would definitely go with AdeptSQL if you're using MSSQL. It's the least good looking but the most talented db compare tool amongst the ones I've tried. It can compare both the structure and the data. It tells you which tables exist on one db but does not exist on the other, compares the structure and data of the common ones and it can produce the script to synchronize the two. It's not free but has a 30 day trial (as far as I can remember)
I tried OpenDiff Tool . Great tool that is free and easy to use .

Why should I upgrade from SQL2000 to SQL2005?

I'm looking for the single biggest reason you are glad that you've already made the jump from SQL2000 to SQL2005.
Recursion without creating temporary tables.
Native Exception support (Try/Catch instead of if #Error goto)
Because:
Microsoft would like to remind customers that support for SQL Server 2000 Service Pack 3a (SP3a) will end on July 10, 2007.
Native XML support is big for us here.
SSIS support. Blows DTS away and is quite handy. :)
SSRS - A really huge advantage for my organization is having the free reporting tools that come with SQL Server 2005. Reporting Services allows me to produce nice looking reports that have exactly the fields that our managers need in very little time. It has a built in tool so they can convert to excel, pdf, or several other formats. Lots of value here.
SSIS - Integration services in 2005 is very powerful for ETL (export, transform, load) functions. You can set up automated processes to run on a schedule.
SSAS - Analysis services looks promising. I have not made any data cubes yet because I want to organize an actual data warehouse. Once you have that, robust data mining algorithms are already built in.
Take a look at these three tools that are included with SQL Server 2005. If i had to pick one as the single biggest reason to move to 2005, it would be SSRS.
At this point, I would suggest looking at SQL Server 2008.
Pagination without (manually) creating temporary tables is a basic, but huge improvement.
However, if you are then going to drag & drop some GridViews in your ASP.NET app directly from the data table, you'd be paging in the app...
CLR integration
Row Versioning-Based Transaction Isolation
I think the single biggest reason is that SQL 2000 is not supported on Vista. I had to move to SQL 2005 because of that.
I don't know if it's just me, but Linq2SQL doesn't exactly work perfectly with SQL 2000. Ordinarily its supposed to automatically generate and populate child collections based on inferences from your schema's keys, foreign keys, RI, etc. Works fine in 2005 but i haven't had much luck in 2000.
Common Table Expressions have proven incredibly useful.
Exception handling... how did we ever manage on SQL 2000...?
PIVOT. That beautiful little statement has saved me more time then any other SQL Server 2005 enhancement.
YOU CAN'T EXPORT TABLES with a "right click" anymore. This is more of a problem than a good reason.
Dynamic Management Views
for Optimisation and to quickly find out the state of the server.