Create Job To Convert Data With SSIS - sql

I Want To Convert Data From OldDatabase To NewDatabase Each Day By SSIS.
for this:
1- Create Script From Exists New DataBase
2- Change DatabaseName OF Generated Script and Then Execute Script To Create NewDatabase2 whit no data.
3- Set SSIS Configuration Parameters.
4- Execute SSIS Package to convert Data.
I Want to do this action by Job.
How I want to do?

your requiremets are not very clear but there are two SSIS tasks that can help you.
If you want to transfer all you can use a "Transfer Database Task"
If you need to specify objects, you can use the "Transfer SQL Server Objects Task" where you can specify things like if you are dropping the objects first and how to deal with the data:

Related

SSIS - connection to new database

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

Dynamic SQL Script path in SSIS Data Flow task

I need to store all the SQL Queries under one folder and refer in the SSIS package to better organize the list of SQL file I am using so we can easily change the SQL file later without having to rebuild the package. This will include all queries that I am using for "Execute SQL task " as well as the queries in "OLE DB Data Source" under Data Flow component.
Under Data Flow task, Instead of putting the SQL query for source data base into the Query Window:
I see four options under Data Access mode for OLE DB Data source-
1. Table or View
2. Table of view name variable
3. SQL Command
4. SQL Command from variable
I understand I could use a variable, store the query in the variable and refer it in "Execute SQL Task" but I am looking for a way to store all the queries in SQL files and it in Data Flow component as well as in "Execute SQL Script Task". I can't seem to find a way to make it dynamic in Data Flow task. Can anyone help with this please?
I don't think storing them as sql files is any good for any type of scenario.
Here is what I would do given what you have described.
You can store the queries as varchar in a table in a database instead of as files. Then you can foreach-loop over the result set and map each row to the variable that you would then use as the query for your oledb data source in the dataflow.
So create a variable and make a for each loop that loops over "select query from dbo.queries" or what ever. Set the output to the variable you created and in the container create your dataflow and set either the source-task with an expression or with "SQL Command from variable".
As for the control flow queries why not just have them be stored procedures that you can change when you need to?

SSIS - Extract multiple databases based on lookup table

How do I create a package that extracts multiple databases(and all tables in each database) from another server based on a lookup table (also found on the other server) that contains a column where all the databases I need to extract is listed ?
I need to use the lookup table because new databases is created from time to time on the source, so I cannot just create a job that extracts a "static set" of databases to a destination. It needs to be a bit dynamic...
Furthermore I also need to extract the databases incremental where I can use a timestamp that exists in all databases/tables.
Im new to SSIS, so an "easy" guide would be appriciated.
Thanks
As a rough idea, you could work with SSIS Package Configurations and executing packages from within packages, and then use the Transfer SQL Server Objects Task:
Make a "Main package" that iterates over the column in your lookup table.
For each entry, it should UPDATE the Package Config entry of your second SSIS package accordingly. Use the "SQL Server" configuration for that second package.
The Main package should then execute the second package - there is a also a task for this.
The second package looks at its config to find out which server to get databases from and uses the Transfer SQL Server Objects Task to do so.
then the Main package continues with the next entry from your lookup table.
Ideally you would want to have your "second SSIS package" inside SQL Server's MSDB rather than the file system. Its easier to execute.

Set up Daily task to import flat file to existing table in SQL Server

here is my newbie to SQL Server Problem.
I created a table with a flat file (.txt) using the Import and Export Data Wizard.
In order to use this table in Arc SDE, I had to create another field named ObjectID.
Need to do the following:
Use the daily generated flat file and erase data from table and replace with new data.
ObjectID field is derived and not in flat file, but need it to stay in table and autopopulate.
Develop script or sql statement
Set up daily process
provide error or completed reports.
Generally speaking, I would use an Integration Services package executed as part of a Sql Server Scheduled Task. Those are the two primary technologies involved, and that should get you started.
you can use ssis technologie (Business Intelligence Development Studio) BIDS, it allows you
to integrate your text file in your sql server table with tranformation you want (adding Object ID field )
a sample :http://www.databasejournal.com/features/mssql/article.php/3832386/Flat-File-Imports-with-SQL-Server-Integration-Services-2008.htm
make a schedule task using a sql agent
a sample here :http://decipherinfosys.wordpress.com/2008/09/17/scheduling-ssis-packages-with-sql-server-agent/

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: