Category Archives: SQL Server Integration Services

SSIS and the Metadata Out of Sync Error

Worked late tonight on a problem we’ve been having with our SSIS (SQL Server Integration Services) package. It would run, but give us a weird error about the metadata being out of sync.

It turned out to be a self inflicted error. In the SQL that drove this particular package, the statement ended with …table1.field3, nvl(table2.field4, ‘Missing’) from table1…. Turns out SSIS didn’t like the nvl part. (nvl by the way is an Oracle statement that equates to if field4 is null, return ‘Missing’, otherwise return field4.) Oh, it understood the nvl command OK, but it didn’t like the fact we failed to alias the command in the SQL.

When I updated the SQL to read nvl(table2.field4, ‘Missing’) as field4 from…, AND I did a build on the package, SSIS was happy. Note though that it kept reporting the problem until I did another build on the package, it drove me nuts for a bit until I thought to rebuild the thing.

To sum it up, never leave just an expression in your SQL, always alias it or you too could fall victim to the mysterious Metadata out of Sync Error.

Advertisements

Arcane Searches

I thought it was time for another round of Arcane Searches. In case you missed the last round, these are some of the search terms users entered into their search engine and managed to run across my blog. I’ll try to pick out a few that seem to occur frequently and answer them. Let’s get started.

ssis package not reading environment variables

There is a policy setting on the server that dictates whether or not the SQL Server job engine can access environment variables.

virtual pc exit fullscreen

To exit full screen mode, use the Right ALT+ENTER combination. Note that the left ALT key won’t work, you must use the right ALT key, with the Enter key.

connectstring SQL compact, connectionstring sql compact edition

These two show up frequently, the connection string for SQL Server Compact Edition (SSCE) is:

Datasource=”C:\MyData\myFile.sdf”; Password=’mypassword’

Note a few things, first the password part is optional. Second, the password must be enclosed in single quotes. Finally, the path to your sdf data file must be in double quotes.

wrap a string in double quotes c#

I’m guessing the search here is how to embed a double quote in a string, that’s easy. Just use a backslash in front of the double quote, and C# will interpret it as a literal character and not a double quote.

string myvar = “Right before he became unconscious, he said \”Yes dear, those pants to make you look fat.\”. “

virtual pc 2007 different ip addresses

Each Virtual PC, be it 2004 or 2007, appears as it’s own PC to the network. Your network hub can’t tell the difference between a virtual machine and a real one, and assigns each machine it’s IP address.

why would I use an interface C#

Why not? OK, sorry, couldn’t resist. Short answer, an interface gives you a way to treat many kinds of objects as if they were all the same kind of object. For example, if you had manager, field worker, office worker, and executive objects, you could have all of the implement the employee interface, then you could treat them all like generic employees to do things like pay, give vacation, etc.

For a more detailed instruction, see my series of posts which begin at https://arcanecode.wordpress.com/2007/02/13/more-oop-interfaces-in-c-part-1/ or http://shrinkster.com/mjk.

There you go, a quick selection of the most common searches I found, that were not already answered in my previous blog entries.

SSIS, BIDS, and TNSNAMES

Today’s alphabet soup has to deal with an issue we struggled over this week at work. For those unfamiliar, SSIS is SQL Server 2005 Integration Services. It’s the rewrite of SQL Server 2000 DTS (Data Transformation Services). You use SSIS to pull data from one database and put it into another.

You develop SSIS in BIDS, Business Intelligence Developers Studio. BIDS is Visual Studio with the BI tools added in. The issue we’ve been fighting had to do with getting our SSIS packages to use Oracle 10g drivers to talk to the Oracle 9i data source that was the beginning point for our packages.

Over and over we got an error that the OLEDB provider could not “Acquire” the database, yet the data source kept passing the “Test Connection” test. It was one of my associates who came upon the clue.

In our environment, we don’t normally use a TNSNAMES.ORA file. TNSNAMES is where Oracle normally stores information about a schema name. Schema names are kind of like URLs. You use a human readable schema name, something like WAREHOUSE1. Oracle driver then goes into TNSNAMES to find the server information so it knows where to route the data to.

As I said, in our environment we don’t use TNSNAMES, instead we have another file. The data driver looks there to get the server that TNS info is stored at for the whole company. This allows us to have a single place to store (and update) TNS data instead of thousands of workstations.

The problem was, BIDS didn’t like that. Even though we had it redirected, BIDS didn’t recognize that and kept going to the TNSNAMES file to find schema info, and in our case it couldn’t find it because it wasn’t there. Once we added a TNSNAMES file BIDS was able to acquire it’s schema info, connect to the database and get whatever data it needed.

The moral of the story is, if you are having problems in BIDS connecting to an Oracle data source verify that you do indeed have a valid TNSNAMES.ORA file.

SSIS Package Not Reading Environment Variables

My work today on SQL Server Compact Edition (see yesterday) has gotten interrupted by some issues with a SQL Server Integration Services (SSIS) package. We keep our connection strings inside environment variables, and had this one package that just would not read those environment variables correctly. To further compound our fun, our development platform is using a 32 bit version of SSIS but our test server is running 64 bit SSIS.

We finally corrected the issue by opening the package in BIDS (Business Intelligence Developer Studio, basically Visual Studio with some SQL Server components loaded into it). Once open, we deleted the connections, recreated them, and then redeployed the package.

And ta-da! It suddenly started working correctly. I put this out here for two reasons: first, to pass along our knowledge in case you are having the same issue. Second, if you’ve had this issue I’m curious to know about it, please leave a comment and let me know your experience.