Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

store procedure don't give data with cross apply

$
0
0

Hi All,

below is my store procedure.

select  col as week_off from Country_Master cross apply(values ('Monday', Weekly_Off_Monday), ('Tuesday', Weekly_Off_Tuesday), ('Wednesday', Weekly_Off_Wednesday), ('Thursday', Weekly_Off_Thursday), ('Friday', Weekly_Off_Friday), ('Saturday', Weekly_Off_Saturday), ('Sunday', Weekly_Off_Sunday)) c (col, value) where bintid_pk=@country_id and value!=0;

When I execute it in sql server it gives data like 

Untitled

I already execute many store procedure using entity framework and those executed successfully.

But when I try to execute the above sp it gives 0 count in variable. I am doing like below.

  SqlParameter user_weekoff_param2 = new SqlParameter("@country_id", Convert.ToInt32(Session["USER-Country"].ToString()));
                        var user_weekoff = db.Database.SqlQuery<WeekOff>("usp_user_role_leave_details @country_id",  user_weekoff_param2).ToList();

I guess here I am using cross apply (which I am using first time) this may be the reason or I need to modify the sp ?

Please suggest.

Thanks


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>