Haw can I insert null value from a query

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • stefy

    Haw can I insert null value from a query

    I'd like insert null value from a query but i can do it,
    if my query is :
    UPDATE table:name UPDATE euro='' WHERE id='5';

    i have a sybase message warning like this :

    Error converting data type varchar to numeric.
    Why ????

  • David Portas

    #2
    Re: Haw can I insert null value from a query

    > i have a sybase message warning like this :

    Sybase? This is an MS SQLServer group.

    The syntax is:

    UPDATE TableName
    SET euro = NULL
    WHERE id='5';

    --
    David Portas
    ------------
    Please reply only to the newsgroup
    --

    "stefy" <@@@ò.@@@@@@@.i t> wrote in message
    news:7Wbjb.2880 54$R32.9468250@ news2.tin.it...[color=blue]
    > I'd like insert null value from a query but i can do it,
    > if my query is :
    > UPDATE table:name UPDATE euro='' WHERE id='5';
    >
    > i have a sybase message warning like this :
    >
    > Error converting data type varchar to numeric.
    > Why ????
    >[/color]


    Comment

    • stefy

      #3
      Re: Haw can I insert null value from a query

      David Portas wrote:
      [color=blue][color=green]
      >> i have a sybase message warning like this :[/color]
      >
      > Sybase? This is an MS SQLServer group.[/color]

      I'm using MS SQLServer but with PHP and Apache, i don't know she (for me Db
      is a girl :) told me Sybase message.
      I'm connecting to SQLServer from a Linux by FreeTDS.
      [color=blue]
      >
      > The syntax is:
      >
      > UPDATE TableName
      > SET euro = NULL
      > WHERE id='5';[/color]

      Thank you !!! It's wotking !!!
      Thank you !!!Thank you !!!Thank you !!!Thank you !!!Thank you !!!Thank you
      !!!Thank you !!!Thank you !!!Thank you !!!Thank you !!!Thank you !!!

      and sorry for my english i'm italian :)

      Hello

      Stefano


      Comment

      • Erland Sommarskog

        #4
        Re: Haw can I insert null value from a query

        stefy (@@@ò.@@@@@@@.i t) writes:[color=blue]
        > I'd like insert null value from a query but i can do it,
        > if my query is :
        > UPDATE table:name UPDATE euro='' WHERE id='5';
        >
        > i have a sybase message warning like this :
        >
        > Error converting data type varchar to numeric.
        > Why ????[/color]

        I would guess that id is a numeric column, whence the error. I don't know
        about Sybase these days, but up till SQL 6.5, MS SQL Server did not have
        auto-conversion from numeric to string and vice versa. If Sybase still
        does not have this auto-conversion, that's 1-0 to Sybase.

        And as David Portas pointed out, use NULL if you mean NULL. The
        empty string is something else. (And is likely to be expanded to a
        single space on Sybase.)

        --
        Erland Sommarskog, SQL Server MVP, sommar@algonet. se

        Books Online for SQL Server SP3 at
        Get the flexibility you need to use integrated solutions, apps, and innovations in technology with your data, wherever it lives—in the cloud, on-premises, or at the edge.

        Comment

        • duncan352
          New Member
          • Jun 2006
          • 2

          #5
          Could you help me out with that as well? I think I may have a slightly different situation though. I need to INSERT a null value that shows just as if I had hit "ctrl+0" in Enterprise Manager.

          The closest I get is having it show as 1/1/1900 when I use the syntax of the following:

          [PHP]$qryStr = "UPDATE OPSCenterISS SET EndDateTime = NULL" or die ("Error in ODBC Update")[/PHP]

          I guess I could delete the row and put the values from it into a new row...but that sounds annoying and dumb. Please let me know if you have any advice on this. I've posted on way too many groups to find no answer. You seem more knowledgable than anyone I've had responses from.

          Comment

          Working...