SSIS - connection to new database - sql

I am new to SSIS so the question might seem simple. What I'm trying to do is to extract data from a source and load it into a new database which should be created in the process (not beforehand). I create that DB using Execute SQL task. However I encounter a problem as I'm unable to connect to that DB using data destination because DB does not exist at that moment.
Can you please help me with ideas how to solve this problem? Or maybe there is any other way how to create the kind of package I described?

I think you need to create db first in your sql server and then point to that db in destination connection. And map the columns with your source query or table with your destination table.

In your requirement you are asking to extract data from suppose Database1 and copy that data in database2. And this should be done during execution of SSIS package.
For this you need to use Execute SQL Task for Destination also.
For example:
Create database Database2;
Insert into Database2.TableName
Select * from Database1.TableName

Related

How to create a database, table and Insert data into it and use it as a source in another data flow in SSIS?

I have a need to create a SQL database and a table and Insert data into the table from another SQL database . And also to use this newly created database as a oledb source in another dataflow in the same SSIS package. The table and database name are fixed.
I tried using script task to create database and tables. But when I have to insert data , I am not able to give database name in the connection manager as the database is created only in runtime.
I have tried setting ValidExternalMetaData to false, but that doesnt seems to help as well.
Any idea or suggestions on how to accomplish this will be of great help. Thanks
I think you just need two things to make this work:
While developing the package, the database and table will need to exist.
Set DelayValidation to true on the connection manager and dataflow tasks in order to avoid failures with connection tests before they are created.
use a variable to hold the new table name create and populate the using the variable then use the variable name in the source object.

Migrating the databases using SSIS package

I was wondering if someone could help me with creating a while loop to iterate through multiple databases(100 databases) and drop/Truncate the tables(Around 60 tables in each database) within those databases.Thank you.
My task is to create an SSIS package to move the data from source database to target database.Data in the destination needs to be truncated as part of the process whenever I run that package the old data need to be truncated and the new data needs to be inserted.
Kindly help.
Thank you.
I am just explain how i would go about this problem.
Hoping the destination and source database,tables are of similar schema.
1) Try to create a table with all the database (Source and destination) details all 60 in a separate database.
2) You need get the database details using execute SQL task from the table and use For Each container for looping the logic of truncate the destination table and then move the data from source database to destination (The data is moved from source database one after other).
3) You will need to use Dynamic SQL and stored procedures for moving the data from source database to destination database (That you must be knowing). or You can use Data flow task too if you don't want to use Stored procedure or Dynamic Queries.
Hope it helps you! :)

How to Export data to Excel in SQL Server using SQL Jobs

I need to export the data from a particular table in my database to Excel files (.xls/.xlsx) that will be located into a shared folder into my network. Now the situation is like this -
I need to use SQL SERVER Agent Jobs.
2.I need to generate a new excel file in every 2 minutes that will contain the refreshed data.
I am using sql server 2008 that doesn't include BI development studio. I'm clueless how to solve this situation. First, I'm not sure how to export the data using jobs because every possible ways I tried had some issues with the OLEDB connection. The 'sp_makewebtask' is also not available in SQL 2008. And I'm also confused how to dynamically generate the names of the files.
Any reference or solution will be helpful.
Follow the steps given below :
1) Make a stored procedure that creates a temporary table and insert records to it.
2) Make a stored procedure that read records from that temporary table and writes to file. You can use this link : clickhere
3) Create an SQL-job that execute step 1 and step 2 sequentially.
I found a better way out. I have created a SSIS(SQL Server Integration Services) package to automate the whole Export to Excel task. Then I deployed that package using SQL Server Agent Jobs. This is a more neat and clean solution as I found.

Create New Database By SSIS

I have two database named: olddatabase and newdatabase. I want to create a new database named newdatabase2 then copy database structure from newdatabase to newdatabase2 and then convert data from olddatabase to newdatabase2.
To copy database structure from newdatabase to newdatabase2 I use Transfer SQL Server Object Task component in SSIS, and then execute SSIS Package to convert data. But in step 1 I dont now how to create new database named newdatabase2. Currently I create the database manually.
There is a "Transfer Database Task". You can use it to make a copy of newdatabase to newdatabase2:
EDIT:
or you can use the "Copy Database Wizard" once. It will generate an SSIS package and a SQL Server job, then you can re-use it as many times as you want.
EDIT2:
it would't make much sense to open on BIDS because you will only see something like this:
I don't think these packages are meant to be editable.
You can access it, though:

Best Approach for migrating data from Access to SQL Server in SSIS

Please Let me know if any best approach available for these two SSIS Activities.
migrating access data to SQL Server table
multiple Access dbs are used as a source to migrate the data into a SQL table.
SQL server table to SQL server table
Is this a one time job that should it be done periodically?
If one time job, then you can use SQL server Import Data utility to accomplish both things easily.
If it is just copy of data from source to destination without any modification to data, then there is no need to use SSIS.
Use the SQL server Import and export wizard, at the end don't click on run now, and save the package , you can schedule these packages to do the same for you,
Yes you can copy from access to SQL table, and from SQL table to SQL table.
http://msdn.microsoft.com/en-us/library/ms140052%28v=sql.105%29.aspx