Stored procedure for INSERT

Results 1 to 2 of 2

Thread: Stored procedure for INSERT

  1. #1
    Join Date
    Dec 1969

    Default Stored procedure for INSERT

    Using a stored procedure, I can insert a text like "Computer" into the Book table. But, if I try to insert "Computer Science" it will give this error:<BR>"Incorrect syntax near the keyword &#039;Science&#039;. " Even if I try to use "Computer_Science", it&#039;ll give the same error.<BR>Does anybody know a way to solve this problem?<BR><BR>This is the stored procedure:<BR>CREATE PROCEDURE [sp_SetBook]<BR>(<BR>@UserID int,<BR>@BookTitle varchar(50),<BR>@getDate datetime<BR>)<BR>AS<BR>INSERT INTO Book (UserID, BookTitle, LVDate) <BR>VALUES (@UserID, @BookTitle,@getDate)<BR>GO

  2. #2
    Join Date
    Dec 1969

    Default RE: Stored procedure for INSERT

    I don&#039;t see anything wrong with the stored procedure.<BR>What command are you giving to call the procedure?<BR>Should be something like this:<BR><BR>sp_SetBook 123, &#039;Computer Science&#039;, &#039;12/31/2001&#039;<BR><BR>And what database are you using?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts