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

emeregency

Scheduled Pinned Locked Moved Database
helpdatabasesql-serversysadmin
5 Posts 2 Posters 0 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.
  • Y Offline
    Y Offline
    yousefshokati
    wrote on last edited by
    #1

    Hi . I am working on a project that is about an audit procedure . it works for all of my tables except one. The one has 51 Fields and because the field has more than 25 field the power could not calculate the result of the Power Function of Sql server CREATE FUNCTION [dbo].[GenColUpdated] (@Col INT, @ColTotal INT) RETURNS INT AS BEGIN DECLARE @ColByte INT, @ColTotalByte INT, @ColBit INT -- Calculate Byte Positions SET @ColTotalByte = 1 + ((@ColTotal-1) /8) SET @ColByte = 1 + ((@Col-1)/8) SET @ColBit = @col - ((@colByte-1) * 8) -- gen Columns_Updated() value for given column position RETURN POWER(2, @colbit + ((@ColTotalByte-@ColByte) * 8)-1) END GO I will Get this error for my table Arithmetic overflow error for type int, value = 281474976710656.000000. i have changed my datatype to int but again it has the same problem ------------------------------------------------------------

    M 1 Reply Last reply
    0
    • Y yousefshokati

      Hi . I am working on a project that is about an audit procedure . it works for all of my tables except one. The one has 51 Fields and because the field has more than 25 field the power could not calculate the result of the Power Function of Sql server CREATE FUNCTION [dbo].[GenColUpdated] (@Col INT, @ColTotal INT) RETURNS INT AS BEGIN DECLARE @ColByte INT, @ColTotalByte INT, @ColBit INT -- Calculate Byte Positions SET @ColTotalByte = 1 + ((@ColTotal-1) /8) SET @ColByte = 1 + ((@Col-1)/8) SET @ColBit = @col - ((@colByte-1) * 8) -- gen Columns_Updated() value for given column position RETURN POWER(2, @colbit + ((@ColTotalByte-@ColByte) * 8)-1) END GO I will Get this error for my table Arithmetic overflow error for type int, value = 281474976710656.000000. i have changed my datatype to int but again it has the same problem ------------------------------------------------------------

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      So change your data type to a bigint in your variable declaration or use a float. Also read the guidelines on how to ask a question!

      Never underestimate the power of human stupidity RAH

      Y 1 Reply Last reply
      0
      • M Mycroft Holmes

        So change your data type to a bigint in your variable declaration or use a float. Also read the guidelines on how to ask a question!

        Never underestimate the power of human stupidity RAH

        Y Offline
        Y Offline
        yousefshokati
        wrote on last edited by
        #3

        thanks for your answer . I have changed it myself again it has the problem . Secondly , about your suggestion : your opinion is respectful for yourself not me by the way thanks for your help i appreciate it

        M 1 Reply Last reply
        0
        • Y yousefshokati

          thanks for your answer . I have changed it myself again it has the problem . Secondly , about your suggestion : your opinion is respectful for yourself not me by the way thanks for your help i appreciate it

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          What I suggest is that you read the guidelines on under the sticky at the top of the page, this will tell you that your title is not very helpful. It is only an emergency to you, not to anyone else and it does not tell us anything about the problem you are asking for help with! Show us the change, I am betting you only changed it for 1 of your variables, do it for all the vars in the formula.

          Never underestimate the power of human stupidity RAH

          Y 1 Reply Last reply
          0
          • M Mycroft Holmes

            What I suggest is that you read the guidelines on under the sticky at the top of the page, this will tell you that your title is not very helpful. It is only an emergency to you, not to anyone else and it does not tell us anything about the problem you are asking for help with! Show us the change, I am betting you only changed it for 1 of your variables, do it for all the vars in the formula.

            Never underestimate the power of human stupidity RAH

            Y Offline
            Y Offline
            yousefshokati
            wrote on last edited by
            #5

            I love u so Much . Thanks a million for your guides . At first i could not get what you mean . for That accept my apologies . I had changed the type of every one of my variables but i had problem only on the return type of the Function . It must have been BigInt too . Thank you so much You helped me a lot Bye the way My Name is "Yousef" . It is same as "Josef" thanks and have a nice day

            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