473,695 Members | 2,224 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL Server Stored Procedure with Text Field

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 spSiteNotePCycl e
@ID int,
@Client_notes text,
@PCycle char(14)
AS
UPDATE Sites
SET Client_notes=@C lient_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.
Nov 19 '05 #1
2 1836
Are you 100% certain that there is data in your variable???

Does it work if you run it manually in Query Analyzer?

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com .
http://www.eggheadcafe.com/forums/merit.asp

"honcho" <go****@nospam. com> wrote in message
news:1121368686 .306eb1d8d8bc6e 793b8b236d5f174 319@bubbanews.. .
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 spSiteNotePCycl e
@ID int,
@Client_notes text,
@PCycle char(14)
AS
UPDATE Sites
SET Client_notes=@C lient_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.

Nov 19 '05 #2
Yes, there is definitely text in the variable.
No, it does not work with Query Analyzer.
I got the answer from a different group yesterday. Instead of UPDATE, I
need to use UPDATETEXT or WRITETEXT. (These are described in Books Online.)
Thank you for your suggestions.

"Robbe Morris [C# MVP]" <in**@eggheadca fe.com> wrote in message
news:O3******** ******@tk2msftn gp13.phx.gbl...
Are you 100% certain that there is data in your variable???

Does it work if you run it manually in Query Analyzer?

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com .
http://www.eggheadcafe.com/forums/merit.asp

"honcho" <go****@nospam. com> wrote in message
news:1121368686 .306eb1d8d8bc6e 793b8b236d5f174 319@bubbanews.. .
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 spSiteNotePCycl e
@ID int,
@Client_notes text,
@PCycle char(14)
AS
UPDATE Sites
SET Client_notes=@C lient_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.


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2239
by: Rob Wire | last post by:
For the code below, how could I add an item in the drop down lists for both company and location to be an "All" selection that would send to the stored proc. spRptAttachments a value of "%" so that it would bring back all attachments at all companies or all locations at a company? Thank you, Rob. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then
0
2643
by: Amber | last post by:
Stored procedures are faster and more efficient than in-line SQL statements. In this article we will look at two SQL Server stored procedures; one using an input parameter and one not, and see how to call them from an ASP.Net page Every modern database system has a stored procedure language. SQL Server is no different and has a relatively sophisticated and easy to use system. This article will not attempt to go into depth in explaining...
9
5270
by: joun | last post by:
Hi all, i'm using this code to insert records into an Access table from asp.net, using a stored procedure, called qry_InsertData: PARAMETERS Long, Long, Text(20), Long, DateTime; INSERT INTO Table ( ID, Cod, CodArt, Q1, DataUscita ) VALUES (pID, pCod, pCod, pQ1, pDataUscita);
7
2219
by: Peter D.C. | last post by:
Hi I want to update data hold in several textbox controls on an asp.net form. But it seems like it is the old textbox values that is "re-updates" through a stored procedure who updates a SQL tabel. I know the SP works, because a smalldatetime-field in the database is changed. I've tried to disable viewstate on all textbox controls. Any ideas to solve this problem.
2
3875
by: kennethgrice | last post by:
Hi, I am new to ASP.net and visual studio.net. I have created a new ASP.NET Web Application and have started with a simple form. I have created a simple test database that will store a person's first and last name and their SSN. The primary key is an autonumbered field.
5
26239
by: Alan T | last post by:
Currently our SQL Server 2000 database table field is using char to store as boolean, ie. "T" or "F". Now we change the field from char to bit field. I am not sure how it has impact on the C# code. For example, the stored procedure returns SELECT * FROM employee There is a field "ismale", "T" is male, "F" is female.
0
2402
by: Big George | last post by:
Hello, I'm trying to save a jpg file of 300KB as a BLOB field in an Oracle 10g Database. If I try to call a Stored Procedure, it fails. If I use CommandText with SQL sentence, it success. I can't save the jpg file as a BLOB field using this Method (I'm calling a Stored Procedure): Private Sub save_BLOB(ByVal Photo As Byte())
0
1851
by: Melanie | last post by:
Hi - my problem is as follows: I'm writing an ASP.Net 2.0 app with C#. From the app, I call a stored procedure that updates some data in the app's database (SQL Server 2000). This stored procedure then declares and assigns a value to a variable of type nvarchar(4000) and calls a 2nd stored procedure, passing it, among other things, the newly created variable. The 2nd stored procedure performs some updates to a different SQL Server 2000...
2
3686
by: shanef1981 | last post by:
Hey Guys, Hoping someone can help me here - I am at my wits end trying to get this to work. I have written a stored procedure in SQL Server to move records from one table to another once verified, and then update two fields. The first field is a varchar field which updates without a hitch. However, the second is an integer field (type smallint) and despite having this declared in my ASP VB.NET code and in SQL server it refuses to...
0
8562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9113
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8830
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8820
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7655
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6488
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4339
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4575
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
1971
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.