I build the following:
USE [RG_ProjectData]
GO
CREATE PROCEDURE AddProjectQuestionContentFrequency
@ProjectQuestionId int,
@ProjectQuestionContent nvarchar(255),
@ProjectQuestionContentFrequency int,
@ProjectQuestionContentDateTime datetime
AS
SET NOCOUNT ON
select ProjectQuestionId, ProjectResponseContent, count (*) ProjectQuestionContentFrequency --------------give alias here
from ProjectResponse
WHERE ProjectQuestionContentDateTime> CAST( convert(VARCHAR(8),getdate(),112) as datetime)
group by ProjectQuestionId, ProjectResponseContent
INSERT INTO [ProjectQuestionContentFrequency] (
ProjectQuestionId,
ProjectQuestionContent,
ProjectQuestionContentFrequency,
ProjectQuestionContentDateTime)
VALUES (
@ProjectQuestionId,
@ProjectQuestionContent,
@ProjectQuestionContentFrequency,
@ProjectQuestionContentDateTime)
GO
I get the following error:
Msg 207, Level 16, State 1, Procedure AddProjectQuestionContentFrequency, Line 11
Invalid column name 'ProjectQuestionContentDateTime'.