TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sivakumar
NA
551
210k
The stored procedure or function does not have a return type
Jun 30 2016 8:22 AM
Hi,
I got error in entity framework :
The stored procedure or function 'GetProjectsByWeek' does not have a return type. ExecuteFunction only supports stored procedures and functions that have a return type.
This is my procedure :
USE [ProjectManagement]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROC [dbo].[GetProjectsByWeek]
@UserID int
AS
BEGIN
CREATE TABLE #DateInsert(WeekNum INT ,WeekStart DATETIME,WeekEnd DATETIME)
DECLARE @WantedMonth DATETIME = getDate()
;WITH Yak(WeekNum, WeekStart, WeekEnd)
AS (
SELECT v.Number AS WeekNum,
DATEADD(DAY, 7 * v.Number - 4, d.Friday) AS WeekStart,
DATEADD(DAY, 7 * v.Number, d.Friday) AS WeekEnd
FROM (
SELECT DATEADD(DAY, DATEDIFF(DAY, 0, DATEADD(MONTH, DATEDIFF(MONTH, 0, @WantedMonth), 0)) / 7 * 7, 4) AS Friday
) AS d
INNER JOIN master..spt_values AS v ON v.Type = 'P'
WHERE v.Number BETWEEN 0 AND 4
)
INSERT INTO #DateInsert(WeekNum,WeekStart,WeekEnd)
SELECT ROW_NUMBER() OVER (ORDER BY WeekNum) AS WeekNum,
CASE DATEDIFF(MONTH, @WantedMonth, WeekStart)
WHEN 0 THEN WeekStart
ELSE DATEADD(MONTH, DATEDIFF(MONTH, 0, @WantedMonth), 0)
END AS WeekStart,
CASE DATEDIFF(MONTH, @WantedMonth, WeekEnd)
WHEN 0 THEN WeekEnd
ELSE DATEADD(MONTH, DATEDIFF(MONTH, -1, @WantedMonth), -1)
END AS WeekEnd
FROM Yak
WHERE 0 IN (DATEDIFF(MONTH, @WantedMonth, WeekStart), DATEDIFF(MONTH, @WantedMonth, WeekEnd))
SELECT U.Username,p.TotalHours,p.WeekStart,p.WeekEnd FROM Users U
INNER JOIN (SELECT SUM(hours) AS 'TotalHours',WeekStart,WeekEnd,UserID FROM [ProjectHours]
CROSS JOIN #DateInsert
WHERE UserID=@UserID AND TaskDate between WeekStart and WeekEnd
GROUP BY WeekStart,WeekEnd,UserID)p ON p.UserID=u.UserID
WHERE U.UserID=@UserID
RETURN
DROP TABLE #DateInsert
END
Please give me help
Reply
Answers (
4
)
How to write query for display data in SQL.
SQL Server Trigger options