I'm getting the following no matter what I do any help would be awesome.
Msg 116, Level 16, State 1, Line 15
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.Msg 109, Level 15, State 1, Line 1
There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
My query
[tableA].[PROJECTID],
[tableA].[STUDYID],
[tableA].[SUBJNO],
[tableA].[CASENUMBER],
[tableA].[CASESTATUS],
[tableA].[MODIFIEDBY]
)VALUES((
SELECT b.PROJECTID,
((SELECT TOP 1 a.STUDYID FROM [PRODVIEW] a WHERE a.DYNAME = b.DYNAME and
a.ProjID = b.PROJID)) as STUDYID,
b.SUBJNO,
(b.SUBJNO + '_' + b.SEQUENCE) as CaseNumber,
'READY' as CASESTATUS,
b.UPLOADEDBY
FROM [dbo].[TableB] b WHERE VIEWED = 0
AND b.UPLOADEDDATE >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)))