I am having a problem when using an INSERT statement with a nested select. The query works when executing it in the SQLManagement Studio but returns an error when executing it in code.
The query looks like :
INSERT INTO [Projects]
VALUES ('1', 'None', '2', '2010/09/08 10:36:30 AM', 4, 1, 4, '6', '', 'n/a', 'no', 'n/a', 'None', 0, 'n/a', 'n/a', 'no', 'A3', 'no', 'Blnk', 'aa',
(SELECT status.statusID from status where name = 'STOPPED')
)
The error returned :
Subqueries are not allowed in this context. Only scalar expressions are allowed
Is there an explanation for this and how will go to solve this issue as I do not know what the id of the Status is, besides executing a separate select query?