SSIS VS_NEEDSNEWMETADATA error - sql-server

I've created a SSIS package in SQL Server to export data from a ODBC source(QuickBase app). I've also scheduled it through a sql job agent in SQL Server and everything is working perfectly.
When there is some changes in source the job will fail.
I'm encountering an error VS_NEEDSNEWMETADATA when I modify the column of source tables from which I'm exporting data.
After refresh metadata it was working but i want permanent solution for this error.
how can I refresh metadata automatically, please hep me.
Thanks.

There is no such functionality provided by SSIS itself. The metadata is a design time function and hence static. You'll have to refresh and revalidate each time the underlying metadata changes.
There are some custom components on codeplex which do the automatic metadata refresh. But the last time I saw one, it was able to do that only for file-system storage.
Just curious to know why do you need to frequently change the metadata? This error comes when an existing column is modified. If the database design is correct, then I would assume such changes will be minimal.

This is when -> You have column name mismatch between source and destination (Correct the name and it should work)
-> You added/ deleted column(s) in source and destination (refresh the metadata)

I fixed it by opening the advanced editor for the source and change the setting "ValidateExternalMetadata" to FALSE

Related

I am getting error while renaming column name or column datatype for tempoal table in TFS

I am using Visual Studio enterprise 2017 (Version:15.71.1) and SSDT(Version:15.1.61804.210)
and also using TFS to keep my code. In my database project all tables are temporal table.
Now when i am changing column type or column name in TFS , i am not able to build my project so not able to generate publish script.
I am getting error :
Error SQL71609: System-versioned current and history tables do not have matching schemas. Mismatched column:"XXXXX"
Do we have any solution for this ?
Generally you can try explicitly defining the history table, then manually keep the schema of the current and history table in sync.
Reference this thread: Avoid schema mismatch in System-Versioned tables
UPDATE:
As you mentioned the solution which worked for you is to make these changes in SQL Server Object Explorer (You can see it by right clicking on DB project and choosing the “View in Object Explorer” option). You need to do the modification here and just save it and it will work.
The solution which worked for me , is to make these changes in SQL Server Object Explorer (You can see it by right clicking on DB project and choosing the “View in Object Explorer” option). You need to do the modification here and just save it and it will work.

Find and log missing/wrong named columns in Excel using SSIS 2012

I am new to SSIS. I am using SSIS 2012 to transfer data from Excel(COZYROC Excel Source Plus component) to SQL server database(OLE DB Destination). My requirement is whenever columns in the excel are not matched with mapped columns or any columns are missing, I should log the error message in the database.
Please help to resolve this problem.
I don't believe that is possible.
SSIS (and SSRS and other applications) require a 'contract' between source and destination such that any changes to the source will throw a mapping error and force the developer to re-map the data flow.
SSIS is not capable of a scenario such as 'if the source columns change, pump the rest and log the changes to another path'.
This is also an example of why Excel makes a terrible data source for a normalized database/ETL project, because users can easily change the Excel doc in such a way that would break data mapping.
Good luck.

Can't update with schema compare

Up until today, I was able to use the Schema Compare feature in Visual Studio 2012 to update a database from a database project. But now, for one project I can do the compare, but the update button is greyed out.
I am able to use other projects to update other database, but from this project I can't update any databases. I do not get any errors, the functionality is just unavailable.
Using publish still works. Also updating the project from the database works, just not the other way around.
Does anyone know why I wouldn't be able to update a database via Schema Compare?
Check the bottom of the screen after a compare it shows status messages there.
I've seen this issue if there is a compile error in the database project. Once the error is resolved close and reopen the compare dialog. Rerun your compare and the Update button should be available again.
You must check database users and database schema. Often, if database users aren't correctly replicated in DB Project, Schema Compare doesn't work.
For me the error list pane and output pane weren't showing anything in Visual Studio 2015. Only after building the database project that I was targetting, was I able to see the errors in the output pane (but still not in the error list pane). After fixing these errors, the Update button was no longer greyed out.
Ran into the same problem myself. As mentioned above, the normal Visual Studio Error List will list errors that block update... but further, there will also be warnings. One of the options that's enabled by default is that data loss blocks the update. That's the problem. Even though it's only a warning condition, any possible data-loss is functionally an error unless you change this flag.
imho, this is a pretty severe UI failure on MS's part, but what are you gonna do?
What worked for me was including the schema.
I was selecting to include only certain tables / procs etc.
If the schema containing the tables and procedures is not also ticked, the import does not include the elements.
You need to ensure that all of your SQLCMD variables have default values.
Right-click onto the project within the Solution Explorer and select Properties.
On the tab to the left, go to SQLCMD Variables and enter the default value(s) into the column provided.
After running your schema compare another time, the update button should now be available.
In my case, the issue was that I had installed a newer version of SQL Server and SSMS (2016). You must always make sure you have the correct version of Sql Server Data Tools installed to match the version you are doing the compare against. Here is the link to SSDT for SQL Server 2005-2017 that I verified working with Visual Studio 2017:
https://learn.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-2017
For me, I changed the order of the tables being added. If there is any relationship between any two tables, you have to add the parent table then dependent one to the database.
Not only does the schema have to be in your database project, it must be kept up to date if it changes on the database. Updates quit working after DBA granted a exec permission to a new sql login in the database on an schema that was in my project. After multiple failures for any stored procedure changes to get applied to my project, I updated the project, selecting only the schema that had changed. After updating the schema in the database project, the Update started working again. I include the schema in all updates. Hope this helps.
Within Schema Compare go to Options -> General -> check *Ignore authorizer*
This issue usualy is thrown if there was a change of tables in one of the two Databases since you've clicked "compare". Regardless weather the change happens on a table that is beeing updated or not.

Element X in the DataSet references an object missing from the Database

When first time I created my App, I created a Database using Microsoft SQL SERVER Management Studio and I connected my App with it.
I created another DB with the same tables and every thing but with diferent names and I let my App to connect to the second one because I want to make some changes and when I am trying to edit my DataSet with Wizard I get this tables page :
as you can see my app couldn't find the right tables and when I am trying to select LastWork table as in the pic, it will make the table name in the DataSet LastWork1.
How I can fix this problem? and let it find the right tables
I've seen this problem when using copies of databases as well, after pointing to a different connection in the settings area of the project properties. The XSD evidently hard codes each DbObjectName with the name of the database and schema in use at design time. One approach to fixing it is to open the wizard for the appropriate dataset, uncheck the red-x objects with the missing references, close the wizard, then re-open it and re-select the objects that are needed. This is not ideal in a large xsd if many findby queries, custom columns, etc. have been added. So an alternative is to do a find and replace on the database name within the XSD itself.
Interestingly, my experience has been that an application runs fine when the connection string points to a differently named but otherwise identical database.

How can I change the source of a Data Source View and the Report Models based on it to a different database?

I have a number of reports deployed to a SQL Server 2005 Reporting Services server. They were all developed using the same Report Model (SDML) that references the same Data Source View (DSV) that points to a test database filled with mostly dummy data. Now, I would like to make those reports pull data from the live database with our real data instead. The two databases have exactly the same structure.
It seems to me, that if I could just change the Data Source being referenced in the Data Source View, then I could redeploy the report model, and all the reports based on it would also reference the correct data. I can see in Business Intelligence Development Studio 2005 that there's an option in the Data Source View property list in Design mode to change the Data Source. So I changed the Data Source, thinking that would work. However, when I try to redeploy the report model after changing the Data Source in the Data Source View, I get a number of error messages like this one:
Error 1 The Table property of the Entity 'Address' refers to the Table 'dbo_address', which is not in the primary data source. Events.smdl 0 0
Is there something else I need to be doing here? Something in the Report Model or Data Source View that should be updated? Is there another way to do what I need to?
Edit 1:
I tried changing the datasource of the report model on the server after the reports were deployed, and that seemed to work pretty well. It's not exactly what I wanted to do, but it works. Thanks everyone.
The strategy that has worked best for me is to deploy the "test" shared datasource to the server then edit it via the Report Manager interface to point to the "production" database (changing the connection string). Making sure of course Overwrite Datasources is set to false on deploy.
Also, your database schema must be the same in test as it is in production.
I don't have as much experience with the report models but generally SSRS doesn't like it when you make changes to the datasource and asks you to refresh all the datasets that you have if you do.
Alternatively, just change the datasource definition on the report server itself.
It sounds like you're changing the data source that the dsv references. Instead, why don't you try to change connection string of the data source. Internally the DSV uses GUIDs to identify the various tables and fields, I suspect that by creating a new data source the GUIDs will change and that is why you're seeing these error messages (as the error message is mapping the internally used GUID to it's "friendly name").
The setup I use has an identically named Data Source (.rds) file for each environment, in the same folder the reports are deployed to. It's just a connection string...
My experience has been the same as zalzaw's - if you change the Data Source, you have to refresh all the datasets associated with the report while pointing at the new environment based on the data source changes. It's very tedious - you go to the Data tab for the report in Business Intelligence Development Studio 2005:
Select a Dataset from the dropdown menu
Click the Refresh button (2nd to the right of the Dataset dropdown, icon looks like recycle)
Repeat steps until all datasets have been refreshed.
Make sure that the database(s) (and stored procedures) are in sync. It's all for naught if a table exists in Dev but not in Test or Prod...

Resources