0

I have a SQL Server and I want to import data from a view into Excel via Microsoft Query.

Sounds easy right? Well it isn't as some of the columns are of a user-defined data type.

tblSeller:

  • ID: int
  • Name: nvarchar(50)
  • Country: CountryName:nvarchar(50)

tblBuyer:

  • ID: int
  • Name: nvarchar(50)
  • Country: CountryName:nvarchar(50)

tblSale:

  • ID: int
  • SellerId: int
  • BuyerId: int

vSales:

SellerName, SellerCountry, BuyerName, BuyerCountry

(I think you get the idea that I have joined tblSale with tblSeller and tblBuyer and want to get names and countries - and since this is just an example I have left out all other stuff which would make it a useful view!!!)

The view vSales works like a charm on my server: It shows me all my information. The problem occurs when I want to import it into Excel 2010 via "From Microsoft Query" (Data => From Other Sources => From Microsoft Query). All columns with a user-defined data type are not available!

Only if I import data directly via "From SQL Server" (Data => From Other Sources => From SQL Server) I get my data. But as my real view contains hundreds of columns and nearly 200.000 rows that is not and option as I need to specify which columns I want to import.

So to put it short: how to import data from a SQL Server view into Excel using a Microsoft Query in order to be able to limit number of columns?

1
  • Changing to non-user-defined data types is not an option :-) Commented Oct 25, 2012 at 10:41

1 Answer 1

0

Sorry for misinforming you... I tried to simplify my question - which also removed the problem!

The definition of the countries was: st_CountryName:nvarchar(50).

And it seems as if Excel is not able to import types where the underscore is a part of the "name". Sorry for misleading you all in my question - but hope someone else will find this answer helpful!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.