Forum Replies Created

Viewing 15 posts - 16 through 30 (of 69 total)

  • RE: Please give me a replacement for a Cursor

    A set solution vs an equivalent cursor solution is at least 3 times faster, and usually 10 times faster. That's why a set solution (and the internal engine that makes...

  • RE: Another DBA Whoops

    This Just won't work.

    order by o.requireddate desc

    won't work.

  • RE: sql query problem a simple one

    this will do the job, even in MSAccess I think.

    select fname from candidatesmst

    where not exists(select * from resumelist where resumelist.candiid= candidatesmst.candiid

    )

    I think it will work, because it...

  • RE: Creating a Global variable

    Hi,

    cool query

    simplicity above ... almost divine

  • RE: how to find Nth week in a month for a given date in sql server?

    And, not tested but, the number of weeks per month

    declare @d datetime, @n int

    set @d = '2005-12-15' -- sample date

    set @n = datepart(wk,dateadd(d,-1,dateadd(m,1,dateadd(d, 1-day(@d),@d )))) - datepart(wk,dateadd(d, 1-day(@d),@d ))...

  • RE: how to find Nth week in a month for a given date in sql server?

    declare @d datetime, @n int

    set @d = '2005-12-15' -- to say anything

    set @n = datepart(wk,@d) + 1 - datepart(wk,dateadd(d, 1-day(@d),@d ))

    select @n -- the nth week...

  • RE: Query help for results order

    This would be:

    SELECT

    case Product_ID

    when 31 then 1

    when 5 then 2

    when 7 then 3

    when 9 then 4

    when 12 then 5

    end,

    *

    FROM Products

    WHERE Product_ID IN (31, 5, 7, 9,...

  • RE: Dynamic record counting

    Also avoid cursor.... , more set oriented

    declare @tablename sysname

    set @tablename = ''

    while (1=1)

    begin

    select @tablename=min(name)

    ...

  • RE: Simple Insert

    The execution of this procedure should follow your new Product addition.

    create procedure p_copyproduct

    (@newProductId int, @prevProductId int)

    as

    begin

    Insert ProductAttribute (ProductId , AttributeId)

    select @newProductId , AttributeId

    from ProductAttribute

    where ProductId =...

  • RE: Avoiding Duplicates

    Union will eliminate duplicates:

    Insert mastertable

    (name, phone, res, calldate)

    select name, phone, res, calldate

    from table1

    union

    select name, phone, res, calldate

    from table2

  • RE: stored procedure to total dates

    Year included, sorted by month.

    select

    Year(entrydate) Y

    , Month(entrydate) M

    , datename(m,entrydate) MName

    , count(*) C

    from tblparticipants

    where entrydate between @start and @end

    group by

    Year(entrydate)

    , Month(entrydate)

    , datename(m,entrydate)

    order by

    Year(entrydate)

    , Month(entrydate)

  • RE: Compound Select to concat rows to 1 column

    This could also help, for A(Column1) and B(Column1,Column2), if you only have sql7

    create procedure p_listBcols

    as

    select Column1

    , min(Column2) Column2

    , convert(varchar(80),min(Column2) ) Col2List

    into #x

    from B

    group by Column1

    while...

  • RE: Another DBA Whoops

    This would be enough:

    select top 5

    o.orderid

    , o.customerid

    , CONVERT(char(10), o.requireddate, 101) as requireddate

    ,o.requireddate rd

    from orders o

    order by rd desc

    Since any single...

  • RE: SQL 7, Replication Problem

    This is an easy one. (Just kidding) The problem might be the synchronization tasks and the miscellaneous tasks (usually daily tasks). All of them must run successfully according to their...

  • RE: SA password change

    Prevent maybe nop but I've remeber my self editing sp_password, so I can log some accounts changes.

    From this point I better take the 5th

Viewing 15 posts - 16 through 30 (of 69 total)