February 4, 2004 at 11:44 am
I am trying to write my first stored procedure and have consulted BOL etc. Can someone help me finish this simple SP to update fields in the ApptOVDetail table after user enters values in unbound controls in the FE:
CREATE PROCEDURE dbo.procApptOVDetailUpdate (@nApptID int)
FOR UPDATE
AS
(
SELECT
ovd.ApptReasonCode,
ovd.RadiolInfoCode,
ovd.MammTime,
ovd.CXRTime
FROM ApptOVDetail ovd
WHERE ovd.AppointmentID=@nApptID
)
I don't know why my where statement turned blue but I can't get it to stop!!
Thanks, guys!!
SMK
February 4, 2004 at 12:34 pm
CREATE PROCEDURE dbo.procApptOVDetailUpdate (@nApptID int, @reason varchar, @cxrtime int)
AS
update ovd
set ovd.apptreasoncode = @reason SELECT
, cxrtime = @cxrtime
FROM ApptOVDetail ovd
WHERE ovd.AppointmentID=@nApptID
return
February 4, 2004 at 1:06 pm
Steve:
From your example, I got this far:
CREATE PROCEDURE dbo.procApptOVDetailUpdate (@nApptID int, @ApReason int, @Radiol int, @mammTime int, @cxrTime int)
AS
Update ovd
set ovd.ApptReasonCode = @ApReason
set ovd.RadiolInfoCode=@Radiol
SELECT
FROM ApptOVDetail ovd
WHERE ovd.AppointmentID=@nApptID
return
Do I not need all those "set"s?
SMK
February 4, 2004 at 1:51 pm
SMK,
Quote:
I don't know why my where statement turned blue but I can't get it to stop!!
UnQuote.
Put a space before and after the equal sign. Since there isn't a space before the @ symbol it thinks it's a URL.
Test:
sometext@sometext blue/thinks it's a URL
sometext @ sometext not blue
-SQLBill
February 4, 2004 at 1:52 pm
I think I have it now. I replaced the "set" with commas and my syntax is successful now.
I will post back if I still can't get it to work.
Thanks!!!
SMK
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply