Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Using Image Data type for a variable is giving error

Using Image Data type for a variable is giving error

Scheduled Pinned Locked Moved Database
help
3 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    indian143
    wrote on last edited by
    #1

    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."

    M Richard DeemingR 2 Replies Last reply
    0
    • I indian143

      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."

      M Offline
      M Offline
      Mathi Mani
      wrote on last edited by
      #2

      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#[^]

      1 Reply Last reply
      0
      • I indian143

        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."

        Richard DeemingR Offline
        Richard DeemingR Offline
        Richard Deeming
        wrote on last edited by
        #3

        The text, ntext and image types have been obsolete for many years:

        ntext, text, and image (Transact-SQL)[^]:

        Important: ntext, text, and image 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. Use nvarchar(max), varchar(max), and varbinary(max) instead.

        Change your variable to varbinary(max). You should also change any columns using the text, ntext or image 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

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups