| | |
Stored procedure and datatype TEXT (ASP)
Please support our MS SQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2008
Posts: 5
Reputation:
Solved Threads: 0
Hi all,
I have searched high and low for this answer but turned up nothing concrete.
I am using MS SQL Server and ASP.
I have a database with a table which includes a field with a TEXT datatype.
I have created a simple stored procedure to select all the fields in the table into a recordset.
I have been able to output these on a web page using ASP, EXCEPT the TEXT field named "Content".
Can anyone tell me how I output the field to the web page?
The stored procedure:
ASP code:
As I say, the other fields output fine...
Thanks for your help, chaps.
I have searched high and low for this answer but turned up nothing concrete.
I am using MS SQL Server and ASP.
I have a database with a table which includes a field with a TEXT datatype.
I have created a simple stored procedure to select all the fields in the table into a recordset.
I have been able to output these on a web page using ASP, EXCEPT the TEXT field named "Content".
Can anyone tell me how I output the field to the web page?
The stored procedure:
MS SQL Syntax (Toggle Plain Text)
CREATE PROCEDURE gettherecords @KeyPhrase varchar(100) AS BEGIN SELECT * FROM TheTable WHERE KeyPhrase = @KeyPhrase END
ASP code:
MS SQL Syntax (Toggle Plain Text)
SET rsResults = Server.CreateObject("ADODB.recordset") rsResults.open "Exec gettherecords '" & varKeyPhrase & "'", connect response.WRITE rsResults("Content")
As I say, the other fields output fine...
Thanks for your help, chaps.
Is you recordset using an oledb or odbc connection? I think odbc in classic asp has issues with text/ntext data types.
•
•
Join Date: Dec 2008
Posts: 5
Reputation:
Solved Threads: 0
Not sure what you mean. Here's the database connection code if that helps:
I have no problem usually reading the Content field from the database. It is only now I am trying stored procedures that the issue has arisen.
Thanks for your reply.
MS SQL Syntax (Toggle Plain Text)
SET connect = server.CreateObject ("ADODB.connection")
I have no problem usually reading the Content field from the database. It is only now I am trying stored procedures that the issue has arisen.
Thanks for your reply.
•
•
Join Date: Dec 2008
Posts: 5
Reputation:
Solved Threads: 0
There is no error that I can see on screen.
The problem I have is that all the other fields in the table (integer, varchar, decimal) are output fine into HTML, using ASP to retrieve the data through the stored procedure into a recordset; however the one field "Content" that is datatype TEXT does not output.
Therefore I am assuming that the TEXT datatype cannot be read by a stored procedure but I thought I'd ask you guys for any guidance or confirmation.
Thanks.
The problem I have is that all the other fields in the table (integer, varchar, decimal) are output fine into HTML, using ASP to retrieve the data through the stored procedure into a recordset; however the one field "Content" that is datatype TEXT does not output.
Therefore I am assuming that the TEXT datatype cannot be read by a stored procedure but I thought I'd ask you guys for any guidance or confirmation.
Thanks.
No .. the problem here lies within ASP. A store procedure can handle any datatype. The "text" datatype can be used for large amounts of data and binary data so it is typically treated differently than normal string data. ex: you can't call 
Sorry I couldn't be of more help.
Len(TextField) in MSSQL, you have to call DataLength(TextField) . But as far as answering your question I have no idea. You should probably ask that in a classic ASP forum which I don't think daniweb has 
Sorry I couldn't be of more help.
•
•
Join Date: Dec 2008
Posts: 21
Reputation:
Solved Threads: 0
Classic ASP and text/ntext is pain, but if your running SQL 2005 then you can use varchar(max) insted, i have not experienced any problems i had with ntext after i switched over to varchar(max).
If your handling datatype TEXT then you should drop using it with the trigger, and change your ASP file to:
Just for fun you could try this in your ASP file (think this is the work-around):
If your handling datatype TEXT then you should drop using it with the trigger, and change your ASP file to:
MS SQL Syntax (Toggle Plain Text)
SET rsResults = Server.CreateObject("ADODB.recordset") rsResults.open "SELECT * From TheTable WHERE KeyPhrase='" & varKeyPhrase & "'", connect response.WRITE rsResults("Content")
Just for fun you could try this in your ASP file (think this is the work-around):
MS SQL Syntax (Toggle Plain Text)
lContent = rsResults("Content") response.WRITE lContent
•
•
Join Date: Aug 2009
Posts: 1
Reputation:
Solved Threads: 0
Hi DorsetBloke,
Not sure if this is still a problem for you, but here is my workaround. In the select statement make sure you specify all the fields you wish to retrieve and make sure the last one in the list is the TEXT field. This should get around the problem.
Tamora (Also a Dorset Bloke!)
Not sure if this is still a problem for you, but here is my workaround. In the select statement make sure you specify all the fields you wish to retrieve and make sure the last one in the list is the TEXT field. This should get around the problem.
Tamora (Also a Dorset Bloke!)
Last edited by tamora; Aug 11th, 2009 at 3:54 am.
![]() |
Similar Threads
- alter table stored procedure...???... (MS SQL)
- Result is not getting from Stored Procedure (ASP.NET)
- Stored Procedure parameter in Crystal ASP.NET Web (ASP.NET)
- datatype TEXT in stored procedure (ASP.NET)
- exec command in stored procedure depends on condition (ASP.NET)
- How to change into stored Procedure (ASP.NET)
- How to connect a SQL stored procedure to a windows application? (VB.NET)
Other Threads in the MS SQL Forum
- Previous Thread: two select statements in one insert statement
- Next Thread: Importing csv to MS SQL
| Thread Tools | Search this Thread |






