Entity Framework and stored procedure returning temp table Issues

Posted by kaplooeymom on Stack Overflow See other posts from Stack Overflow or by kaplooeymom
Published on 2012-03-18T17:07:55Z Indexed on 2012/03/18 17:54 UTC
Read the original article Hit count: 286

(Disclaimer - I'm not the database designer. I'm just the poor developer what has to make this work.)

There are 17 (at the moment) tables with identical structure - name, address, phone number.

Given a phone number, I have to check to see if there's a matching entry in any of the tables, then return that address.

So, I created a view to get the list of tables (there's a ref table that holds that info), then I created a stored procedure to

  1. create a temp table,
  2. using cursors, check each table in the view for the phone number, using sql concatenation. If a record is found, insert it into the temp table.
  3. return the rows from the temp table.

This all works in straight T-SQL.

Now, I'm trying to use Entity Framework 4+ to call the stored procedure. But the function import interface won't generate columns. It says return type = none, and the LINQ code expects an int and won't compile.

Any ideas on how to make this work?

I know I can move the check tables part to code, if I absolutely have to, but I'd rather have the above method work.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about entity-framework