Forum Replies Created

Viewing 12 posts - 1 through 13 (of 13 total)

  • RE: TinyInt, SmallInt, Int and BigInt

    The part of the article I loved is where it was pionted out how many integers I'm wasting. My boss will kill me if I do it at work,...

    Kindest Regards,

    --SF

    (SELECT COALESCE(Phlogiston,Caloric,DarkMatter) as Construct FROM Science.dbo.Theory)

  • RE: Convert positive number to a negative

    D'oh!

    Here I was all smug 😎 about: -1*sign(@a)*@a

    when yours: (-1)*abs(@a)

    is even more elegant. 🙂

    Kindest Regards,

    --SF

    (SELECT COALESCE(Phlogiston,Caloric,DarkMatter) as Construct FROM Science.dbo.Theory)

  • RE: A Matter of Degree

    B.A. in Anthropology (with a heavy tilt toward Archaeology).

    Though between 1995 (when I was kicked out of university) and 2003 (when I finally graduated from that same university) is when...

    Kindest Regards,

    --SF

    (SELECT COALESCE(Phlogiston,Caloric,DarkMatter) as Construct FROM Science.dbo.Theory)

  • RE: Convert positive number to a negative

    Here's another way to always endup with a negative number (this works whether you start with a positive or a negative number):

    DECLARE @a INT

    SET @a = 1

    SET @a = (-1)*sign(@a)*@a

    Select...

    Kindest Regards,

    --SF

    (SELECT COALESCE(Phlogiston,Caloric,DarkMatter) as Construct FROM Science.dbo.Theory)

  • RE: Remove Decimals Without Rounding

    I was wondering the usefulness myself. Unless you store elsewhere data to put back in the decimal, I can't imagine the number being very useful. But I'm sure...

    Kindest Regards,

    --SF

    (SELECT COALESCE(Phlogiston,Caloric,DarkMatter) as Construct FROM Science.dbo.Theory)

  • RE: Remove Decimals Without Rounding

    Fixed for 12345.0

    Declare @original decimal(25,10)

    Set @original = 12345.0 -- 09876504321.120345678

    IF (@Original-(cast(@Original as bigint))) = 0

    select cast(@Original as bigint)

    ELSE

    select cast(@Original*power(10,len(cast(Reverse(cast(@Original-(cast(@Original as bigint)) as decimal(25,14))) as decimal(25,0)))) as decimal(25,0))

    Not quite as elegant...

    Kindest Regards,

    --SF

    (SELECT COALESCE(Phlogiston,Caloric,DarkMatter) as Construct FROM Science.dbo.Theory)

  • RE: Remove Decimals Without Rounding

    And for those of you who, unlike me, remember that you can use bigint if int is too restrictive, this works as well as my last post, and doesn't have...

    Kindest Regards,

    --SF

    (SELECT COALESCE(Phlogiston,Caloric,DarkMatter) as Construct FROM Science.dbo.Theory)

  • RE: Remove Decimals Without Rounding

    Well, it's not quite ideal as I can't use numbers with 10 decimal places. My method is restricted to 9 digits after the decimal place, but that isn't too...

    Kindest Regards,

    --SF

    (SELECT COALESCE(Phlogiston,Caloric,DarkMatter) as Construct FROM Science.dbo.Theory)

  • RE: Remove Decimals Without Rounding

    OK. I've gotten around my the problem with my earlier submission where I was restricted to 9 digits to the left of the decimal, and 6 digits to the...

    Kindest Regards,

    --SF

    (SELECT COALESCE(Phlogiston,Caloric,DarkMatter) as Construct FROM Science.dbo.Theory)

  • RE: Half a Million

    Thanks to SQLServerCentral.com I can lie, cheat, and steal.

    I lie around the site, soaking up information by reading articles, scripts, challenges, etc.

    I cheat the future by reading about issues others...

    Kindest Regards,

    --SF

    (SELECT COALESCE(Phlogiston,Caloric,DarkMatter) as Construct FROM Science.dbo.Theory)

  • RE: Remove Decimals Without Rounding

    Now keep in mind, I'm still kind of a newbie, but this seems to work ok. Though it gacks if you use more than 9 digits before or more...

    Kindest Regards,

    --SF

    (SELECT COALESCE(Phlogiston,Caloric,DarkMatter) as Construct FROM Science.dbo.Theory)

  • RE: Being passed on after an interview

    The other side of this coin is the interviewer who doesn't have the decency to let you know you've been passed. This has only happened to me once, but...

    Kindest Regards,

    --SF

    (SELECT COALESCE(Phlogiston,Caloric,DarkMatter) as Construct FROM Science.dbo.Theory)

Viewing 12 posts - 1 through 13 (of 13 total)