Forum Replies Created

Viewing 15 posts - 61 through 75 (of 568 total)

  • RE: Date and time Display

    Hi ram,

    In which format of the time you have?

    7.30, 7:30, 7hours 30 min, so that its appears as 7:50

  • RE: display other value if column is nothing !

    Hi,

    The table schema haven’t the null, so that it’s happened some time,

    Use the case statement to set this issue, like

    select a.CID,a.trainingId,

    (case when (a.nomFR = '') or (a.nomFR is null) then...

  • RE: SERVER REBOOT REPORT

    One of the options to get thro by OS level, log would capture in the MMC (Microsoft management console), in the event viewer, unless the disk clean up activity, the...

  • RE: how can I get uniqueidentifier value as return after insert a record

    Hi,

    Because the OP needs to get the unique identifier in every row insert!!!

  • RE: how can I get uniqueidentifier value as return after insert a record

    Hi,

    use the trigger to get the newid value

    create table MYTABLE

    (

    col1 int,

    col2 varchar (2)

    )

    CREATE trigger ins_trg_MYTABLE on MYTABLE

    for INSERT

    as

    PRINT CONVERT(varchar(255), newid())

    return

    insert into MYTABLE

    select 1,'A'

  • RE: query takes too long to execute needs to improve query...

    samirprogrammer (1/15/2010)


    select * from tableA inner join tableB on tableA.id=tableB.id and tableA.date=(select max(date) from tableB where id=tableA.id)

    Hi,

    try this

    select a.* from tableA a

    inner join

    (select id,max([date]) [date]

    from tableB

    group...

  • RE: splitcsv

    Jeff Moden (1/15/2010)


    Would you share with us why you want to do this unusual thing first?

    Hi Jeff,

    The OP needs to set the posted function (may created for another reason) to...

  • RE: Subtotal of grouped values (Matrix)

    Hi,

    For the sub total, the rollup method is best to achieve,

    Or use this simple statement

    select * from MYTABLE

    union all

    select col1+' TOTAL',sum(col2),sum(col3),sum(Total) from MYTABLE

    group by col1

    order by col1

  • RE: Insert date plus 4 weeks

    sc-w (1/13/2010)


    INSERT INTO wce_activity (uniqueid, createdate, reminderdate) VALUES ('"& (uid) &"','"& date() &"','" DATEADD(mm, + 1, GETDATE()) "')

    Hi,

    Try this

    INSERT INTO wce_activity (uniqueid, createdate, reminderdate)

    select user_id() ,getdate(),dateadd(m, 1, getdate())

    or

    INSERT...

  • RE: 10 digit random unique alpha-numeric number

    Abhijeet Dighe (1/12/2010)


    I need to generate a random 10 digit alphanumeric string that is also unique within a table.

    Hi,

    This @random string value is unique unless you pass...

  • RE: 10 digit random unique alpha-numeric number

    Hi,

    Unique string for the table/procedure

    Declare @random varchar(10)

    set @random = CONVERT(varchar(10), right(newid(),10))

    apply this @random string in the table/procedure

  • RE: 10 digit random unique alpha-numeric number

    Hi Abhijeet,

    Big bucket mentioned code for random of the alphanumeric is fine, but not suit for the SQL 2000, you use the newid() to get the simple random like

    select...

  • RE: Is this possible? Select Statement difficulties

    Hi,

    Try to make all the four separate select statement in to one statement by using UNION operation. Like

    Select 'Savings per Policy' as TYPE , subpolicy_name, SUM(CO2_savings) As total_savings

    From #CO2temp

    group...

  • RE: Compare data to the same time last year?

    --Today

    SELECT convert(varchar(15),getdate(),103)

    --Yesterday

    SELECT convert(varchar(15),getdate()-1,103)

    --LAST YEAR

    SELECT convert(varchar(15),((dateadd(year,-1,getdate()-1))),103)

  • RE: Compare data to the same time last year?

    --Today

    SELECT cast(convert(varchar(8),getdate(),1) as datetime)

    --Yesterday

    SELECT cast(convert(varchar(8),getdate()-1,1) as datetime)

    --LAST YEAR

    SELECT cast(convert(varchar(8),(dateadd(year,-1,getdate()-1)),1) as datetime)

    --Today

    SELECT DATEADD(day,DATEDIFF(day, 0, GETDATE()),0)

    --Yesterday

    SELECT DATEADD(day,DATEDIFF(day, 0, GETDATE()),-1)

    --LAST YEAR

    SELECT DATEADD(YEAR,-1,(DATEADD(day,DATEDIFF(day, 0, GETDATE()),-1)))

Viewing 15 posts - 61 through 75 (of 568 total)