Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.46 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Ignore Arithmetic Overflow in microsoft sql server
  2. SELECT CONVERT(bigint, 0x8000000000000000)-1
  3.        
  4. Arithmetic overflow error converting expression to data type bigint.
  5.        
  6. SET ARITHABORT OFF;
  7. SET ARITHIGNORE ON;
  8. SET ANSI_WARNINGS OFF;
  9.  
  10. SELECT ISNULL(CONVERT(bigint, 0x8000000000000000)-1, 9223372036854775807)
  11.        
  12. select CONVERT(bigint, 0x8000000000000000)-CONVERT(bigint, -1)
  13. -9223372036854775807
  14.        
  15. select CONVERT(bigint, 0x7FFFFFFFFFFFFFFF)
  16. 9223372036854775807