Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 sql data type

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-05 : 07:59:06
Rod writes "how can i declare or use the TEXT or nTEXT data types"

dsdeming

479 Posts

Posted - 2002-04-05 : 08:22:46
Wish you could, but you can't. Text, image, and ntext are allowed for local variables.

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-04-05 : 08:23:33
Include the column definition in your CREATE TABLE or ALTER TABLE statement:

CREATE TABLE myTable (textCol text)

You can also create a stored procedure that ACCEPTS a text/ntext parameter:

CREATE PROCEDURE showText @textvar text AS
SELECT @textvar


BUT...you cannot manipulate or declare a text variable. It can only be passed into a stored procedure. Unfortunately you cannot take a text column and put it into a text variable either, as far as I know (I've been TRYING to figure this out, no luck yet) The only way for this procedure to work is to include the literal value when you EXECUTE the procedure:

EXECUTE showText @textvar='This is a really short text value.'

Go to Top of Page
   

- Advertisement -