Forum Replies Created

Viewing 15 posts - 526 through 540 (of 569 total)

  • RE: Help with SUM

    Hi,

    Try this

    select a.weekno,b.invtotal

    from

    invoices as a,

    (

    select weekno,sum(gross) as invtotal

    from invoices

    group by weekno

    )as b

    where

    a.weekno = b.weekno

    and b.invtotal > 10000

    ARUN SAS

  • RE: Converting serial numbers into time format

    Hi,

    try this

    its in the 24 hrs timing so its easy to convert

    declare @starttime char(4),

    @endtime char(4),

    @starttimeconv char(6),

    @endtimeconv char(6)

    --must pass in char

    select @starttime = '2000',@endtime = '2130'

    select @starttimeconv = substring(@starttime,1,2)+'.'+substring(@starttime,3,4)

    select @endtimeconv =...

  • RE: function to identify the special characters in a table

    Hi Singh,

    You need to update the space to ‘XX’

    Then

    UPDATE dbTABLE

    set tblColA= ‘XX’

    where tblColA like ' ' –space(not a singe code,with one space)

    ARUN SAS

  • RE: Run same SQL or Stored Proc for multiple databases

    Hi,

    try this

    DECLARE AllDatabases CURSOR FOR

    SELECT name FROM master.dbo.sysdatabases WHERE dbid > 4

    OPEN AllDatabases

    DECLARE @DBNameVar NVARCHAR(128),@Statement NVARCHAR(300)

    FETCH NEXT FROM AllDatabases INTO @DBNameVar

    WHILE (@@FETCH_STATUS = 0)

    BEGIN

    PRINT N'CHECKING DATABASE...

  • RE: how to convert a bigint value to datetime

    HI,

    Try this code

    declare @abc table (TEST bigint)

    declare @DATE1 datetime

    select @DATE1 = getdate()

    insert into @abc values (convert(bigint,@DATE1))

    01)

    select * from @abc

    RESULT

    39898

    02)

    select convert(datetime,39898)

    RESULT

    2009-03-28 00:00:00.000

    ARUN SAS

  • RE: Rajkumar- INTERNAL SQL SERVER ERROR

    Hi,

    Show your statement(codeing)

    ARUN SAS

  • RE: How do you create a crosstab query?

    HI,

    Try this code

    create table #abc

    (

    part varchar(2),

    qty int,

    date datetime

    )

    insert into #abc values ('A',10,'2009-01-01')

    insert into #abc values ('A',20,'2009-01-02')

    insert into #abc values ('A',28,'2009-01-03')

    insert into #abc values ('B',10,'2009-01-01')

    insert into #abc values ('B',28,'2009-01-02')

    insert into...

  • RE: How do you create a crosstab query?

    Hi dub,

    You need the output like this?

    PART(Col1)02/18/2009(Col2)03/01/2009(Col3)03/15/2009(Col4)03/25/2009(Col5)

    Part A qty 12 qty 10qty 0qty 0qty 0

    Part B qty 5 qty 2qty 0qty 0qty 0

    ARUN SAS

  • RE: Automatically change LOWER to UPPER

    HI,

    Before inserting into the table you just made the data to upper then insert,

    It’s so simple than trigger.

    ARUN SAS

  • RE: Update int field with Datediff in subquery?

    HI,

    try this code

    create table MstRun

    (

    RunID int IDENTITY(1,1),

    RunDate datetime,

    RunHorseID int,

    DaysSinceLastRun int

    )

    create procedure HorseID_Insert

    (

    @RunDate datetime,

    @RunHorseID int

    )

    as

    begin

    declare @Days int, @DaysUP int

    select @Days = 9999

    if not exists (select 'X' from MstRun

    where...

  • RE: Dynamic SQL

    HI,

    Show your codings

    ARUn SAS 🙂

    REPETED

  • RE: Dynamic SQL

    hi,

    Show your codings

    ARUN SAS

  • RE: Speed up (not like) query

    HI,

    1) By Increase the where condition

    You want increase the speed of response?

    Any how show you statement

    ARUN SAS

  • RE: problems with distinct

    Hi,

    Use of the DISTINCT, merges rows were all columns are identical (as mentioned in the Lynn Pettis commend) but in OP, the values not identical then why the DISTINCT should...

  • RE: Stored procedure

    HI,

    TRY THIS

    declare @abc table

    ( name1 varchar(10),

    date1 datetime,

    sale int,

    ID1 int

    )

    insert into @abc values ('A','2009-03-21',90000,1)

    insert into @abc values ('B','2009-03-21',60000,2)

    insert into @abc values ('C','2009-03-21',70000,3)

    insert into @abc values ('D','2009-03-21',90000,4)

    insert...

Viewing 15 posts - 526 through 540 (of 569 total)