Forum Replies Created

Viewing 15 posts - 136 through 150 (of 568 total)

  • RE: update query error

    Hi,

    Unless the table schema and few data, it’s hard to take the decision, however try this

    update a

    set a.j_num = c.new_j_num

    from p_audit a,tbl1 b, tbl2 c

    where

    b.p_numr=a.new_p_num and

    b.tbl1_id=c.tbl2_id

  • RE: summing up the gross from the previous rows

    Hi,

    In my desk no errors show yet. Check the data you have.

  • RE: Manipulating Decimal Format 0000000090.00000

    :w00t:

    you are welcome!!!

  • RE: summing up the gross from the previous rows

    Hi,

    Yes this also corrected by means of call the sub statement in the rollup like

    Use this data

    select 'XX1',2,'AA',10

    union all

    select 'XX1',1,'BB',30

    union all

    select 'XX2',4,'CC',30

    union all

    select 'XX2',5,'DD',40

    union all

    select 'XX2',3,'EE',50

    union all

    select 'XX3',6,'FF',50

    Your existing statement

    select...

  • RE: summing up the gross from the previous rows

    Hi,

    Nice approach with rollup, rollup also another way to achieve this requirement, but what the OP say this different, that is, try to compare with arrive result and find. ...

  • RE: Manipulating Decimal Format 0000000090.00000

    Hi,

    Is really need to show in this format?

    Ok try this

    declare @result numeric(16,5), @final nchar(16)

    set @result = 100

    set @final = REPLICATE('0',(10-len(floor(@result))))+ cast(@result as nchar(16))

    select @final

  • RE: summing up the gross from the previous rows

    Hi, try this

    create table #temp1

    (

    CCID varchar(10),

    Sno int,

    Item varchar(10),

    Amount int

    )

    insert into #temp1

    select 'XX1',1,'AA',10

    union all

    select 'XX1',2,'BB',30

    union all

    select 'XX2',3,'CC',30

    union all

    select 'XX2',4,'DD',40

    union all

    select 'XX2',5,'EE',50

    union all

    select 'XX3',6,'FF',50

    select CCID,Sno,Item,Amount from #temp1

    union all

    select a.CCID,a.Sno+1,b.Item,a.Amount

    from (select CCID,max(Sno)Sno,sum(Amount)Amount

    from #temp1

    group...

  • RE: How to split the value

    Hi,

    Cewii lift good question, OP may forget to mentioned this, unless the common character how we move further? Ok let assume and doing,

    The common characters exists in the string, try...

  • RE: complex query

    Ankur Bhardwaj (12/7/2009)


    Find all the employees who have joined at last day of month in last 3 years (2007,2008,2009)

    Hi,

    First you get the last date for all month like

    create table #temp

    (

    slno...

  • RE: Spliting different character lengths

    smthembu (12/6/2009)


    but the temp table and the union statements are confussing.

    Hi,

    Ok, the mentioned above #temp1 table is for the example table, I don’t know the real source table from your...

  • RE: Spliting different character lengths

    hi,

    NO, this for the sample to understand with one record,

    you try this way

    create table #temp1

    (

    name1 varchar(50)

    )

    insert into #temp1

    select 'A,AA'

    union all

    select 'AA,AAA'

    union all

    select 'AAA,AAAA'

    union all

    select 'B,BB'

    union all

    select 'BB,BBB'

    union all

    select 'BBB,BBBB'

    select substring(name1,0,patindex('%,%',name1))first_col,

    substring(name1,patindex('%,%',name1)+1,len(name1))...

  • RE: Spliting different character lengths

    Hi, try this,

    declare @result varchar(50)

    set @result = 'smith,john'

    select substring(@result,0,patindex('%,%',@result))first_col,

    substring(@result,patindex('%,%',@result)+1,len(@result)) se_col

  • RE: how to calculate the avgerage of the value based on time interval

    jprabha.d (12/5/2009)


    Hi ,

    the first column is of DateTime

    The second column is of varchar datatypes.

    thanx

    Jaya

    Hi,

    create table #temp2

    (DATE1 smalldatetime,memory varchar(5))

    insert into #temp2

    select '2009-01-01 01:00:00',11

    union all

    select '2009-01-01 02:00:00',22

    union all

    select '2009-01-01 08:00:00',33

    union...

  • RE: how to calculate the avgerage of the value based on time interval

    Hi, try this

    create table #temp2

    (DATE1 smalldatetime,memory float)

    insert into #temp2

    select '2009-01-01 01:00:00',11

    union all

    select '2009-01-01 02:00:00',22

    union all

    select '2009-01-01 08:00:00',33

    union all

    select '2009-01-01 10:00:00',44

    union all

    select '2009-01-01 15:00:00',55

    union all

    select '2009-01-02 06:00:00',66

    union all

    select '2009-01-02 12:00:00',77

    union all

    select...

  • RE: URGENT: Question about merge and hash JOIN

    Hi,

    Ref this for your interview questions

    http://support.microsoft.com/kb/197297

Viewing 15 posts - 136 through 150 (of 568 total)