localzuk Posted February 25, 2009 Posted February 25, 2009 Hi all, I have written the following procedure and I can't get it to save as Visual Studio keeps telling me that 'there's an error near '('', which isn't very helpful... Any ideas why this is happening? It is supposed to try and update a row, if it doesn't exist then insert it instead (it is a more efficient way than running a select command then running an update or an insert command, as it only calls indexes once). CREATE PROCEDURE dbo.InsertPupil @FirstName varchar(100), @LastName varchar(100), @AdmissionNumber varchar(10), @FreeMeals integer, @Photo image, @PupilType integer AS UPDATE People SET(FirstName=@FirstName, LastName=@LastName, FreeMeals=@FreeMeals, Photo=@Photo, TypeID=@PupilType) WHERE AdmissionNumber=@AdmissionNumber IF @@ROWCOUNT=0 INSERT INTO People (FirstName, LastName, AdmissionNumber, FreeMeals, Photo, TypeID) VALUES (@FirstName, @LastName, @AdmissionNumber, @FreeMeals, @Photo, @PupilType) RETURN Any help would be appreciated
localzuk Posted February 25, 2009 Author Posted February 25, 2009 Don't mind me. The answer was very simple... There shouldn't be any parentheses around the data after SET in the UPDATE command.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now