A couple weeks ago a user complained that on one of our development databases, one of the views he was linking to via Access was missing some of the columns. There were no permissions issues and the columns all showed up properly if they looked at the view via SSMS; but when they went into Access and linked to the view… the columns weren’t there. After scratching our heads for a bit, we realized that the user didn’t have access to the User defined Types that the columns in the underlying table were designated as. SQL doesn’t actually care about this, you can view data in the table or view whether you have the references permission or not… but Access is a bit more picky and will ignore the column if the user doesn’t have the proper permissions. Normally we grant references on these types to Public in all the databases so that we don’t have this issue, but on this particular development server we forgot. This is another issue that can be very puzzling when it happens out of the blue and is very hard to Google information on if you don’t already understand the cause.
Here’s a quick example:
Setup behind the scenes. I created a user with db_datareader privileges in my TestDB. I created a system ODBC link using this user account. Then I did the following:
Note that per BOL:
Unlike user-defined types that are created by using sp_addtype, the public database role is not automatically granted REFERENCES permission on types that are created by using CREATE TYPE. This permission must be granted separately.
So, the newly created UDT’s have no permissions intrinsically granted. Next I’ll attempt to pull that table into Access.
Access Sees only 2 of the fields. All it takes to fix this is a simple permissions grant to the user though (Or Public so that you don’t have to deal with this again)
GRANT REFERENCES ON TYPE:: dbo.MyUDTA TO AccessTestUser