Exporting SQL View returns all PK's

Support for DataSlave

Moderators: Tom, ian

Exporting SQL View returns all PK's

Postby breener96 » Sat Feb 18, 2012 5:43 pm

I am exporting data from a SQL database view and writing the export to a text file. The view is defined to have 5 columns and uses an inner join on 2 tables. The view does not return the primary keys from the tables, but does return other related data. The export to the text file has 7 columns, 2 more than it should. The 2 extra columns are the primary keys.

Take the example:

Table Cars
CarID, ColorID, ModelID

Table Colors
ColorID, Name

Table Models
ModelID, Name

View v_Cars
select Cars.CarsID, Colors.Name, Model.Name
from Cars inner join colors on Cars.ColorID = Colors.ColorID inner join ModelID on Cars.ModelID = Models.ModelID

From this, if you export the view from SQL, you return the 3 columns Cars.CarsID, Colors.Name, Model.Name. When I then direct the output from the SQL export to a text file, the textfile returns 5 columns
Cars.CarsID, Colors.Name, Model.Name, Colors.ColorID, Models.ModelID. This is an undesired result.

Why is this happening?
Posts: 10
Joined: Fri Oct 15, 2010 12:22 am

Re: Exporting SQL View returns all PK's

Postby ian » Tue Feb 21, 2012 8:29 am

Can you check what build you are running. To do this look at the properties of the exe file in the program files directory.

We will investigate, however you may want to use SQL instead of the view as a workaround while we investigate. If you please send the sql to create the two table and the view to support we can test with the same conditions.
Posts: 364
Joined: Sat Dec 18, 2004 8:13 am
Location: UK

Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest