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