Using Image Data type for a variable is giving error
-
Hi All, I am trying to loop through a table and put the all the values into variables to further use logic on them, is there any way we can assign an Image value to a variable, when I am trying to do it, I am getting for the following error and when I am trying to convert the value of the image into nvarchar then also it is giving me errors that I can't convert. Can anybody please help me either by a code snippet, a link or even suggestion. Thanks in advance. The error it is giving is
The text, ntext, and image data types are invalid for local variables
Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."
-
Hi All, I am trying to loop through a table and put the all the values into variables to further use logic on them, is there any way we can assign an Image value to a variable, when I am trying to do it, I am getting for the following error and when I am trying to convert the value of the image into nvarchar then also it is giving me errors that I can't convert. Can anybody please help me either by a code snippet, a link or even suggestion. Thanks in advance. The error it is giving is
The text, ntext, and image data types are invalid for local variables
Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."
Since no code is posted, there is no way to see how you are storing and/or retrieving image. This CP article explains the steps. Please take a look. Storing and Retrieving Images from SQL Server Using Strored Procedures and C#[^]
-
Hi All, I am trying to loop through a table and put the all the values into variables to further use logic on them, is there any way we can assign an Image value to a variable, when I am trying to do it, I am getting for the following error and when I am trying to convert the value of the image into nvarchar then also it is giving me errors that I can't convert. Can anybody please help me either by a code snippet, a link or even suggestion. Thanks in advance. The error it is giving is
The text, ntext, and image data types are invalid for local variables
Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."
The
text
,ntext
andimage
types have been obsolete for many years:ntext, text, and image (Transact-SQL)[^]:
Important:
ntext
,text
, andimage
data types will be removed in a future version of Microsoft SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Usenvarchar(max)
,varchar(max)
, andvarbinary(max)
instead.Change your variable to
varbinary(max)
. You should also change any columns using thetext
,ntext
orimage
types to their supported equivalents.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer