Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / February 2007

Tip: Looking for answers? Try searching our database.

How to return text data type from stored procedure.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Archana - 28 Feb 2007 14:13 GMT
Hi all,

I am having one stored procedure which is returing parameter having
text data type.

This paramter has to take value from table which have column with
datatype as text.

How will i set value to parameter having text datatype to value
present in table?

Any help will be truely appreciated.
SQL_Beginner - 28 Feb 2007 14:26 GMT
> I am having one stored procedure which is returing parameter having
> text data type.
[quoted text clipped - 4 lines]
> How will i set value to parameter having text datatype to value
> present in table?

You would just SELECT it, not set it to a variable.  You can't have a
variable of type TEXT.  And you can't RETURN anything other than an INT, so
I assume you meant OUTPUT, not RETURN.

In SQL Server 2005 you can use VARCHAR(MAX) which is a first-class
citizen -- meaning you can DECLARE @foo VARCHAR(MAX) and proceed with
storing 2GB of text in there if you want.

A
Aaron Bertrand [SQL Server MVP] - 28 Feb 2007 15:12 GMT
> I am having one stored procedure which is returing parameter having
> text data type.

You can't return anything but an INT, and it is *NOT* meant to return
*DATA* -- return values are meant to return error/status.  Single data
elements that are not part of a resultset should be "returned" via an OUTPUT
parameter.

And you can't store TEXT as a local variable... maybe you could use
VARCHAR(MAX) in SQL Server 2005.  Otherwise all you can do is SELECT
TextColumn FROM table and have the application consume the result that way.

Signature

Aaron Bertrand
SQL Server MVP
http://www.sqlblog.com/
http://www.aspfaq.com/5006

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.