1

I am using Windows Authentication to connect to a SQL-SERVER database. I am using version 4.47.02 of Linqpad.

If you see the attached image, the same table in Sql server has more columns than the columns displayed in Linqpad.

EDIT: The columns that do not get displayed have a UDT for a data type.

How can I get all the columns in linqpad?

sqlserver vs linqpad

abhi
  • 3,082
  • 6
  • 47
  • 73
  • Not an answer, but it often helps to realize that LINQPad uses entity framework to bind to the underlying MSSQL database. So your question might translate to "why doesn't Entity Framwork display all the columns in my database"? – Frank van Puffelen Jan 29 '14 at 16:50
  • What does LinqPad show when you change your language to SQL? – sgmoore Jan 29 '14 at 17:30
  • @FrankvanPuffelen By default LINQPad does **not** use EF. (See http://www.linqpad.net/howlinqpadworks.aspx) – sgmoore Jan 29 '14 at 17:36
  • @sgmoore When I change the language to SQL in query mode, I get all the columns that are present in the Table. In C# Expression and C# Statement, that I am not able to access the highlighted columns. – abhi Jan 29 '14 at 17:56
  • 1
    What types are those columns? It may be falling over because it can't resolve them to the equivalent type; I had a quick look in a local SQL db, and don't have any columns with '(not null)' and no type. – Chris Jan 29 '14 at 19:46
  • @Chris, it looks like you've hit the nail on the head. They are UNKNOWN TYPE. This table is a part of a schema supplied by the vendor. Now the question is how do I fix this? – abhi Jan 29 '14 at 20:16
  • @sgmoore Oops... thanks for pointing out that LINQPad does not necessarily use EF. That definitely makes the problem more interesting. :-) – Frank van Puffelen Jan 29 '14 at 21:49
  • 2
    That seems tricky, I had a read of http://msdn.microsoft.com/en-us/library/vstudio/bb386909%28v=vs.100%29.aspx and http://stackoverflow.com/questions/781081/linq-to-sql-and-clr-user-defined-types. Not sure I can suggest anything more helpful though =D – Chris Jan 29 '14 at 22:33

1 Answers1

3

LINQPad supports user-defined data type aliases, but not user-defined CLR types. The latter is not easy to deal with, as suggested by the link that Chris posted.

Community
  • 1
  • 1
Joe Albahari
  • 30,118
  • 7
  • 80
  • 91
  • The columns in question are based on a user-defined data type. If I create similar columns on my SQL Server Express edition, I am able to see them. Do I need any kind of privileges on system views for LINQPad to resolve the column data type? – abhi Jan 30 '14 at 17:41
  • It's not about privileges. It's because LINQPad relies on LINQ-to-SQL which cannot deal with CLR UDTs. – Joe Albahari Jan 31 '14 at 02:42