I build the following:
USE [RG_ProjectData]
GO
CREATE PROCEDURE AddProjectQuest ionContentFrequ ency
@ProjectQuestio nId int,
@ProjectQuestio nContent nvarchar(255),
@ProjectQuestio nContentFrequen cy int,
@ProjectQuestio nContentDateTim e datetime
AS
SET NOCOUNT ON
select ProjectQuestion Id, ProjectResponse Content, count (*) ProjectQuestion ContentFrequenc y --------------give alias here
from ProjectResponse
WHERE ProjectQuestion ContentDateTime > CAST( convert(VARCHAR (8),getdate(),1 12) as datetime)
group by ProjectQuestion Id, ProjectResponse Content
INSERT INTO [ProjectQuestion ContentFrequenc y] (
ProjectQuestion Id,
ProjectQuestion Content,
ProjectQuestion ContentFrequenc y,
ProjectQuestion ContentDateTime )
VALUES (
@ProjectQuestio nId,
@ProjectQuestio nContent,
@ProjectQuestio nContentFrequen cy,
@ProjectQuestio nContentDateTim e)
GO
I get the following error:
Msg 207, Level 16, State 1, Procedure AddProjectQuest ionContentFrequ ency, Line 11
Invalid column name 'ProjectQuestio nContentDateTim e'.
USE [RG_ProjectData]
GO
CREATE PROCEDURE AddProjectQuest ionContentFrequ ency
@ProjectQuestio nId int,
@ProjectQuestio nContent nvarchar(255),
@ProjectQuestio nContentFrequen cy int,
@ProjectQuestio nContentDateTim e datetime
AS
SET NOCOUNT ON
select ProjectQuestion Id, ProjectResponse Content, count (*) ProjectQuestion ContentFrequenc y --------------give alias here
from ProjectResponse
WHERE ProjectQuestion ContentDateTime > CAST( convert(VARCHAR (8),getdate(),1 12) as datetime)
group by ProjectQuestion Id, ProjectResponse Content
INSERT INTO [ProjectQuestion ContentFrequenc y] (
ProjectQuestion Id,
ProjectQuestion Content,
ProjectQuestion ContentFrequenc y,
ProjectQuestion ContentDateTime )
VALUES (
@ProjectQuestio nId,
@ProjectQuestio nContent,
@ProjectQuestio nContentFrequen cy,
@ProjectQuestio nContentDateTim e)
GO
I get the following error:
Msg 207, Level 16, State 1, Procedure AddProjectQuest ionContentFrequ ency, Line 11
Invalid column name 'ProjectQuestio nContentDateTim e'.
Comment