How to get over "Can't get text, text and graphic variables". on SQL Server?
2 answers
If you are using SQL Server 2005
, you can use NVARCHAR(MAX)
:
CREATE TABLE text_test (test NTEXT NOT NULL)
INSERT
INTO text_test
VALUES ('test')
DECLARE @t NVARCHAR(MAX);
DECLARE txt_cur CURSOR FOR
SELECT test
FROM text_test
OPEN txt_cur
FETCH NEXT
FROM txt_cur
INTO @t
CLOSE txt_cur
DEALLOCATE txt_cur
GO
DROP TABLE text_test
GO
+2
source to share
FIrst why you are using cusrsor cursors should be avoided at all costs. If you use a set-based solution, your problem may go away. However, without any idea as to what you are trying to do with an inteh cursor, it is difficult to give advice. Of course, I cannot change the fact that SQL Server does not allow you to put text data in a variable. When you run into a system limitation, you need to rethink what you do and how you do it.
+1
source to share