Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to send update to SQL Server
Message
From
07/10/2003 12:26:48
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00835189
Message ID:
00835829
Views:
28
You don't send the cursor back to SQL Server. You send the data back, in the form of parameters to the stored procedure.

CREATE PROCEDURE dbo.author_update
@au_id nvarchar(10)
, @au_lname nvarchar(20)
, @au_fname nvarchar(20)
AS
UPDATE authors SET
au_lname = @au_lname
,au_fname = @au_fname
WHERE au_id = @au_id


EXECUTE dbo.author_update @au_id = ..., @au_lname = ..., @au_fname = ...

I'm sure that there are dozens of more complete examples.

-Mike

>I have not come to the chapter in your book on using stored procedures, so maybe it is covered there. But so far I have no idea on how to update a table in SQL Server using stored procedure. That is, I understand that, using SPT, you can retrieve a set/cursor, then make it updatable, bind form controls to the fields in the cursor. But how do you send the cursor back to be used by a stored procedure to update the table is not clear. I am sure this is vary naive question.
>
>Thank you for your input.
>
>but I was
>>#3 - Using SPT and calling a stored procedure.
>>
>>-Mike
>>
>>>As far as getting the data from SQL Server, I like using SQL pass through.
>>>
>>>But I am not sure what is a better (preferred or recommended) way of sending changes back to the SQL Server. I am aware of two methods:
>>>
>>>1. Making cursor updatable and using TABLEUPDATE()
>>>
>>>2. Using cursor (without making it updatable) and then building a SQL UPDATE string based on the cursor/table fields and sending it to the SQL Server using SQLEXEC().
>>>
>>>Any suggestions?
>>>
>>>Thank you
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform