Forum Replies Created

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

  • RE: Split CSV file - this is different

    Hi,

    You could bcp out the data, then bcp/BULK INSERT it back in again.

  • RE: Displaying every combo of unique id values

    The pleasure was on my side, Mr Yoda.

  • RE: Displaying every combo of unique id values

    Very nice anyway,

    and sharp of you to spot this way getting all the possible groups / permutations.

    The code is extremely fast as well, good job

  • RE: Displaying every combo of unique id values

    "select N.N as GroupID, V.ID

    from @Numbers N

    inner join @Vals V

    on (power(2,V.ID-1) & N.N) = power(2,V.ID-1)

    order by N.N, V.ID"

    Very impressive Yoda!

    Is this a "known" algorithm, or did you work it out...

  • RE: Displaying every combo of unique id values

    This is hardcoded for up to 4 ID's ( but it would not be too hard to generate the dynamics )

    Good Luck.

    /************************************************************************************/

    -- setup

    set nocount on

    create table #t([ID] int identity, [Desc]...

  • RE: Select date/time field on a daily basis

    ok do:

    select    *

    from      msglog

    where     datediff(day,msglog_crtdt,floor(cast(getdate()-1 as float))) = 0

    for previous day ( i.e. day before getdate() )

    /rockmoose

  • RE: Select records closest to 10:00am?

    Try:

    select tbl.*

    from

    tbl join

    (select [ID],[DATE],max([TIME]) as [TIME] from tbl

    where [TIME] < '18991230 10:00:00.000'

    group by [ID],[DATE] ) as closest_to_ten

    on tbl.[ID] = closest_to_ten.[ID]

    and tbl.[DATE] = closest_to_ten.[DATE]

    and tbl.[TIME] = closest_to_ten.[TIME]

    /rockmoose

  • RE: Select date/time field on a daily basis

    To get all the transactions for 2004-12-10,

    You could do this:

    select    *

    from      msglog

    where     datediff(day,msglog_crtdt,'20041210') = 0

    /rockmoose

  • RE: converting hours to minutes

    Hi,

    Try this in QA, and see if you get any wiser..

    create table #t(hhhh_mm nvarchar(20))

    insert #t(hhhh_mm) select N'211:34' union select N'11:34' union select N'1:34'

    select hhhh_mm, left(hhhh_mm,charindex(N':',hhhh_mm)-1) * 60 + right(hhhh_mm,2) as...

  • RE: The Bowling Challenge

    Yes, very quiet on this topic for a while...

    /rockmoose

  • RE: Stored Procedure Backups

    Whoa, nice script Harry.

    SQLDMO also has scripting capabilities, but I guess you knew that.

     

  • RE: Without dynamic SQL, Top X Query

    Ok, No Idea.

    Don't see why SET ROWCOUNT would make it much slower compared to TOP.

    You could try to hint:

    OPTION( FAST 200 ) in the select , see if it makes...

  • RE: Refer to calculated field in expressions?

    You're welcome,

    Well next time you will remember to alias your derived table 🙂

    /rockmoose

  • RE: Without dynamic SQL, Top X Query

    If the ROWCOUNT xxx is outside the dynamic sql...

    Put it inside the dynamic Sql.

    You would gain performance by avoiding Dynamic Sql if possible.

    /rockmoose

  • RE: Stored Procedure Backups

    If you have selected a database in EM ( or level below database )

    You have the GenerateSqlScript in the tools menu.

    /rockmoose

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