Question

Here is what i am trying to achieve,

1) Start the loop from 5 years back from current year 
2) Check if database for that year is exist if not create new one  ?
3) move the tables according to there year of creation into the database of that year ?

For this i have created the SSIS package i have added the the connection manager which connection string sets dynamically for each loop of year that connection string works fine when checking for the database existence and the creating new database but when the package try to execute the sql task for moving the data tables then it throws error as

[Execute SQL Task] Error: Connection manager "dummyserver.dummydatabase2012" does not exist.

any help would be great ..

Was it helpful?

Solution

You say you set the connection string dynamically. In that connection string make a variables for the ServerName and the IntialCatlog and assign that property values using variable names and then change that variables names as your connection demands at runtime using script task or if they coming from database then using `sql task. Let me know if any issues.

OTHER TIPS

If you need to create a new database, create a connection manager to the Master database. You can use that one CM to work with all databases, just use the DB.SCHEMA.TABLE syntax when referencing tables (eg. select * from mydb.dbo.mytable).

You can try to create the table each time using a SQL statement like this

CREATE TABLE IF NOT EXISTS TableName ...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top