I have a table variable with two columns. The first column is a value that I am trying to populate while the second value is being populated by the execution of a stored procedure.
CREATE PROCEDURE [dbo].userProfiles
(@userID INT) AS
BEGIN
DECLARE @sampleTable TABLE (moduleName VARCHAR(20),
userProfile int)
INSERT INTO @sampleTable('userprofile', exec getUserProfile(@userID))
SELECT *
FROM @sampleTable
END
However, I keep getting this error whenever I try executing the stored procedure:
Level 15, State 1, Procedure userProfiles, Line 9
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'userprofile'.
Any help will be well appreciated .
Thanks in advance