Forum Replies Created

Viewing 15 posts - 226 through 240 (of 1,114 total)

  • RE: Query to get the minimum id

    Greg,

    it is not giving the expected result. I have to get the minimum Eff_date(where Eff_date is greater than getdate() ) then the correspoinding id should be displayed.

  • RE: Query to get the minimum id

    The table contains only the date not datediff.

    so first i need to calculate the datediff,then i need to get the id.

    Modified Table Structure:

    Create table Log

    (

    ecode int,

    id int,

    Eff_Date datetime

    )

    insert into log

    select...

  • RE: Query to get the minimum id

    I used the below query to get the id.

    select id from

    log where ecode = 100

    and datediff = (select min(datediff)

    from log

    where ecode = 100)

    There is a small change in the...

  • RE: RESTORE issue

    I got this backup file from (SDMS_OLAP.bak) some one of my team person.

    There is no option to create one more backup as the server is not available now.

    Using this...

  • RE: Datepart Function ate egg

    Sergiy (5/15/2009)


    karthikeyan (5/15/2009)


    Hi All,

    I have one scenario.

    declare @mm char(2)

    declare @gdate datetime

    select @gdate = '03/31/2009'

    select @mm = convert(char(2),datepart(month,@gdate))

    select @mm

    It is showing 3. But i need the output as 03.

    I modified...

  • RE: DECIMAL,calculation,truncation

    Lynn Pettis (5/7/2009)


    karthikeyan (5/7/2009)


    Lynn,

    Yes.It will work.. But I have more than one row in the table,so i can't use local variable here, becuase it lead us to use 'LOOP'.

    Really, and...

  • RE: DECIMAL,calculation,truncation

    Sergiy (5/7/2009)


    karthikeyan (5/7/2009)


    Sorry! I am not getting you...

    Try again.

    Here is a shorter version of your code, easier to get:

    DECLARE @Fixed2 decimal(8,4)

    SET @Fixed2 = 12121.03

    Thanks Sergiy! I have identifed my mistake...i...

  • RE: DECIMAL,calculation,truncation

    Lynn Pettis (5/7/2009)


    karthikeyan (5/7/2009)


    Lynn Pettis (5/6/2009)


    karthikeyan (5/6/2009)


    I tried the below code

    DECLARE @Fixed1 decimal(8,4), @Fixed2 decimal(8,4), @Fixed3 decimal(16,8);

    SET @Fixed1 = 5444.32;

    SET @Fixed2 = 12121.03; <-- Problem is here. decimal(8,4)...

  • RE: DECIMAL,calculation,truncation

    Lynn Pettis (5/6/2009)


    karthikeyan (5/6/2009)


    I tried the below code

    DECLARE @Fixed1 decimal(8,4), @Fixed2 decimal(8,4), @Fixed3 decimal(16,8);

    SET @Fixed1 = 5444.32;

    SET @Fixed2 = 12121.03; <-- Problem is here. decimal(8,4) means you only...

  • RE: DECIMAL,calculation,truncation

    RBarryYoung (5/6/2009)


    Karthik:

    There is a course in most graduate & undergraduate math & CompSci programs called "Numerical Analysis", have you taken it yet? I ask because it is...

  • RE: DECIMAL,calculation,truncation

    Lynn,

    Yes.It will work.. But I have more than one row in the table,so i can't use local variable here, becuase it lead us to use 'LOOP'.

  • RE: DECIMAL,calculation,truncation

    I tried the below code

    DECLARE @Fixed1 decimal(8,4), @Fixed2 decimal(8,4), @Fixed3 decimal(16,8);

    SET @Fixed1 = 5444.32;

    SET @Fixed2 = 12121.03;

    SET @Fixed3 = @Fixed1 * @Fixed2;

    SELECT @Fixed3

    I got the truncation error.

    To multiply two decimal(8,4)...

  • RE: DECIMAL,calculation,truncation

    Sergiy,

    FLOAT worked well. Can you tell me why my code failed to give the accurate result?

    Also i have to convience my manager to alter the table to FLOAT data...

  • RE: Column,Date,Update

    Lynn,

    I am using sql2000.

    I have identified the month end date for the given input range now.

    i.e input date = 28/apr/2009

    so @year_st = 01/01/2009

    @year_end = 28/apr/2009 --...

  • RE: Column,Date,Update

    Thanks Jeff.

    Meantime i have developed the below code to get the desired output...

    DECLARE @Input_Date DATETIME

    SELECT @Input_Date = '28/apr/2009'

    DECLARE @Year_St DATETIME,

    @Year_End DATETIME

    SELECT...

Viewing 15 posts - 226 through 240 (of 1,114 total)