Home All Groups Group Topic Archive Search About

Stored Procedure with a Field of Type "text"

Author
14 Jul 2005 8:29 PM
honcho
Hello,

Does anyone have an example of an SQL Server stored procedure that updates a
record, where one of its field is of type "text"?  My procedure is

/*
**  Update the client note and production cycle in a Sites record.  Set the
**  When_submitted field to the current date/time.
*/
CREATE PROCEDURE spSiteNotePCycle
   @ID int,
   @Client_notes text,
   @PCycle char(14)
AS
UPDATE Sites
SET Client_notes=@Client_notes, When_submitted={ fn NOW() }, PCycle=@PCycle
WHERE (ID = @ID)
GO

The procedure executes successfully, and after the update I get the expected
results in the When_submitted and PCycle fields.  But I get only an empty
string in Client_notes.  Is this because it is of type "text"?  Does "text"
in a stored procedure require me to do something different?

Any help will be gratefully appreciated.

Author
14 Jul 2005 9:12 PM
Alejandro Mesa
See UPDATETEXT in BOL, there you will find an example.


AMB

Show quote
"honcho" wrote:

> Hello,
>
> Does anyone have an example of an SQL Server stored procedure that updates a
> record, where one of its field is of type "text"?  My procedure is
>
> /*
> **  Update the client note and production cycle in a Sites record.  Set the
> **  When_submitted field to the current date/time.
>  */
> CREATE PROCEDURE spSiteNotePCycle
>    @ID int,
>    @Client_notes text,
>    @PCycle char(14)
> AS
> UPDATE Sites
> SET Client_notes=@Client_notes, When_submitted={ fn NOW() }, PCycle=@PCycle
> WHERE (ID = @ID)
> GO
>
> The procedure executes successfully, and after the update I get the expected
> results in the When_submitted and PCycle fields.  But I get only an empty
> string in Client_notes.  Is this because it is of type "text"?  Does "text"
> in a stored procedure require me to do something different?
>
> Any help will be gratefully appreciated.
>
>
>
Author
15 Jul 2005 2:16 PM
honcho
Thank you for the suggestion.  UPDATETEXT in BOL lead me to WRITETEXT, which
is exactly what I need.

Show quote
"Alejandro Mesa" <AlejandroM***@discussions.microsoft.com> wrote in message
news:C41EB6E0-24A9-4051-B724-14C13771E03E@microsoft.com...
> See UPDATETEXT in BOL, there you will find an example.
>
>
> AMB
>
> "honcho" wrote:
>
>> Hello,
>>
>> Does anyone have an example of an SQL Server stored procedure that
>> updates a
>> record, where one of its field is of type "text"?  My procedure is
>>
>> /*
>> **  Update the client note and production cycle in a Sites record.  Set
>> the
>> **  When_submitted field to the current date/time.
>>  */
>> CREATE PROCEDURE spSiteNotePCycle
>>    @ID int,
>>    @Client_notes text,
>>    @PCycle char(14)
>> AS
>> UPDATE Sites
>> SET Client_notes=@Client_notes, When_submitted={ fn NOW() },
>> PCycle=@PCycle
>> WHERE (ID = @ID)
>> GO
>>
>> The procedure executes successfully, and after the update I get the
>> expected
>> results in the When_submitted and PCycle fields.  But I get only an empty
>> string in Client_notes.  Is this because it is of type "text"?  Does
>> "text"
>> in a stored procedure require me to do something different?
>>
>> Any help will be gratefully appreciated.
>>
>>
>>

AddThis Social Bookmark Button