Results 1 to 2 of 2

Thread: Division

  1. #1
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    149

    Unanswered: Division

    I am trying the following SQL

    declare @var1 Float
    set @var1 = 1/2
    select @var1

    I need @var1 to be 0.5 instead of 0. Can you please let me know how I can get that?

    Thanks

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    declare @var1 Float
    set @var1 = 1.0/2
    select @var1

    or

    declare @var1 Float
    set @var1 = 1/2.0
    select @var1

    or

    declare @var1 Float
    set @var1 = 1.0/2.0
    select @var1


    int / int yields an int result!
    Paul Young
    (Knowledge is power! Get some!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •