MSSQL - view is missing a column

259 Views Asked by At

I'm trying to import some data from a MSSQL-Database using R but I'm running into Errors.

[1] "42S22 207 [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'SOME_COLUMN'."                                                  
[2] "42000 4413 [Microsoft][ODBC SQL Server Driver][SQL Server]Could not use view or function 'MY_VIEW' because of binding errors."
[3] "[RODBC] ERROR: Could not SQLExecDirect 'SELECT * FROM MY_VIEW'" 

I've also tried reading some data using RazorSQL

enter image description here

I've done some research and I'm guessing the problem is, that SOME_COLUMN has been removed from the views underlying table. Is there a way to get the query on which the view is based? So far I've tried this:

select definition
from sys.objects     o
join sys.sql_modules m on m.object_id = o.object_id
where o.object_id = object_id( 'MY-SCHEMA.MY_VIEW')
  and o.type      = 'V'

But this query returns nothing. Is there a way to get the query of the view? And is there a way to get the data from the view or do I have to tell the database guys to fix the view first? Thanks in advance!

0

There are 0 best solutions below