I keep receiving the error message Incorrect syntax near ')' whilst trying to save a stored procedure from within visual studio, I get the same error from within enterprise manager. The procedure is incomplete but valid, any idea appreciated. The procedure follows:
CREATE PROCEDURE dbo.ProcessComment
@.source AS VARCHAR(50) = NULL
AS
SET NOCOUNT ON
DECLARE @.sourceID AS INT
DECLARE @.counter AS INT
DECLARE @.Sources TABLE
(
sourceid AS INT,
lastconversation AS DATETIME
)
SET @.sourceID = -1
SET @.counter = -1
/*We need to see if this is a new or existing source*/
IF NOT @.source = NULL
BEGIN
INSERT @.Sources SELECT sourceID, lastconversation
FROM sources
WHERE name = @.source
ORDER BY lastconversation
--Do we have any matching sources or is this a new source?
--We need to pick the most likely source from the table
--The most likely source will be either one with an open conversation
--or the latest conversation or if we are lucky the only
--one in the result set
END
Thanks
Gav:
These two lines:
sourceid AS INT,
lastconversation AS DATETIME
need to be changed to:
sourceid AS INT,
lastconversation AS DATETIME
The compiler "thinks" that you are defining a computed column when you include the "AS" keyword.
|||Thanks Mugambo, that sorted me out :)
Dave
I wonder where I picked up that 'AS' syntax from in a table declaration, it just rolled off my fingertips onto the keyboard.
Thanks a lot.sql
No comments:
Post a Comment