SQL Server 2005 - Export Table Programmatically (Run a .SQL File to Rebuild It)

export all sql table records in vs 2005 (vb.net)

This thread on the topic has over 100 posts!

http://social.msdn.microsoft.com/Forums/en/sqltools/thread/546f4407-0aa4-4b04-96f3-e6f0ba39a9d1

This similar thread may prove valuable:

SQL Server 2005 - Export table programmatically (run a .sql file to rebuild it)

and 1 more resource...

http://social.msdn.microsoft.com/Forums/en/transactsql/thread/31a15a51-f557-499c-96a9-df7faccde98d

Microsoft SQL Server 2005: Create alias for database

You can do replication from one database to another database on the same machine. You can also copy data directly without having to create an alias. For instance if you had a table named Users in DB2 and a Users table in DB1 and they are the same schema you could easily just do

INSERT INTO DB1..Users
select * from DB2..Users

Now, a synonym would allow you to use a table from DB2 as if it was a table in DB1 so for instance if you have a table named Products in DB2 you could do

use DB1
GO

CREATE SYNONYM [dbo].[Products] FOR [DB2].[dbo].[Products]
GO

-- Now the following would give you the same result
select * from DB2..Products
select * from Products

For more information on synonyms see here

Is it possible for 2 sql server 2005 databases to share a read only secondary data file (.ndf file)?

Clever things can be done with copies, replication, log shipping, mirrorring, and whatnot, but ultimately it is not possible for SQL Server database to actually share database files.

Exporting data In SQL Server as INSERT INTO

In SSMS in the Object Explorer, right click on the database, right-click and pick "Tasks" and then "Generate Scripts".

This will allow you to generate scripts for a single or all tables, and one of the options is "Script Data". If you set that to TRUE, the wizard will generate a script with INSERT INTO () statement for your data.

If using 2008 R2 or 2012 it is called something else, see screenshot below this one

alt text

2008 R2 or later eg 2012

Select "Types of Data to Script" which can be "Data Only", "Schema and Data" or "Schema Only" - the default).

Sample Image

And then there's a "SSMS Addin" Package on Codeplex (including source) which promises pretty much the same functionality and a few more (like quick find etc.)

alt text

SQL Server 2005/2008 - Import a fixed width text file via the command line?

You do have similar functionality with SQL Server. I would encourage you to learn about format files. This page, from Microsoft, does a fairly good job of explaining it.

http://msdn.microsoft.com/en-us/library/ms178129.aspx

I would also encourage you to read this blog:

6 ways to import data into SQL Server

Sql 2005 Backups and Schema Changes Interactions

Yes, you are correct.

All changes, whether structural changes or data modifications, within the database (i.e. any object that resides within the database) since your last full database backup will be recorded by any subsequent differential backup that you execute.

I hope this clears things up for you but please feel free to pose further questions.

cheers, John



Related Topics



Leave a reply



Submit