Izenda, LLC

Ad Hoc Reports & Dashboards for ASP.NET Apps

Free Trial

Izenda Reports is licensed on a "per user" or "per server" basis. Please complete this form to receive a price quote.

All fields are required.

The live demo demonstrates Izenda reports with the Northwind Sample database. To login, please register below.

All fields are required.

Please register to try Izenda reports on your data today.

All fields are required.

I would like to migrate some but not all of my data from a...

Expand / Collapse
 

I would like to migrate some but not all of my data from a database?


This can be done by following the following steps.

1. Create a new database. Simply right click on databases and select new. Give the database a name and click ok.

For Example purposes we will name the Database "SampleDB"

2. Run the script below after making the following changes to the script:

Change all instances of SampleDB to the Database name you just created

Change all instances of NewTable to the table name you would like to create

Change OriginalDB to the name of the database where the data is coming from

Change TableName to the name of the table where the data is coming from

Change Field1 to the name of the first field you are importing

Change Field2 to the name of the second field you are importing

Add additional fields to the create table, insert into, and select from lines

Set the character type for the first field - currently it is set to a float

Set the character type for the second field - currently it is set to a varchar(50)

set the character type for any additional fields you added.

3. Once all the above changes are done you can execute the script. This will clean up some errors you may get from importing data.

-- Use Destination DB

USE SampleDB
GO

--CREATE TABLE IF IT DOESN'T EXIST

if not exists (select * from sysobjects where name='Report2' and xtype='U')
CREATE TABLE [dbo].[NewTable](
[Field1] [float] NULL,
[Field2] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
) ON [PRIMARY]

--
DELETE FROM [SampleDB]..[NewTable]
--INSERT THROUGH SELECT
INSERT INTO [SampleDB]..[NewTable] (FIeld1,Field2)
SELECT Field1,Field2 FROM [OriginalDB]..[TableName]




Details
Type: FAQ
Options