Forum Replies Created

Viewing 15 posts - 31 through 45 (of 64 total)

  • RE: Need help to optimize my query

    'trivial piece of code', yes, if you speak pivot 😛

    I modified your code a bit (removed the expensive join with ShiftsTable) and got this:

    select ShiftStartDate, dateadd(hour, 8, ShiftStartDate) ShiftEndDate, [11],...

  • RE: Need help to optimize my query

    OK, I rewrote my question. Hope it is clearer now.

  • RE: Random updates from another table

    OK, you probably mean something like this:

    ;with temp as (

    select row_number() over (order by checksum(newid())) Id, c1, c2, c3

    from #Table2

    )

    select *

    from #Table1...

  • RE: Random updates from another table

    Thanks Vedran, the trick with row_number and cross join works great 🙂 I did it this way:

    ;with temp as (

    select top 1000 row_number() over (order by...

  • RE: Random updates from another table

    Thanks Vedran, but this isn't quite the solution I was looking for.

    Some other facts:

    - Table1 is created and populated from another application, only columns c1, c2, c3 (in reality up...

  • RE: substring funcation.

    Maybe you could use something like this:

    select substring(LEFT(@exampleString, Charindex('<leadId>', REPLACE(@exampleString, ' ', ''))), Charindex('<reason>', REPLACE(@exampleString, ' ', '')), LEN(@exampleString))

    We don't need to know the length because from the documentation:

    If the...

  • RE: Try...Catch with transactions

    Sounds logical, thanks 🙂

  • RE: Try...Catch with transactions

    Grant Fritchey: what kind of errors could occur in the initiation of the transaction?

    Reji: and where is the difference?

  • RE: Get spans from a table

    ... but extremely slow on big tables though, probably because of cross join...

  • RE: Get spans from a table

    Works great, thanks!

    And the article goes to my to-do list 🙂

  • RE: Table function - list of parameters

    OK,

    I created a stored procedure with only one parameter (comma delimited) and used Jeff Moden's parsing technique.

    Thanks

  • RE: Table function - list of parameters

    One option could be, that I always call the procedure with 2 parameters (table name, list of columns):

    exec CheckProcedure('Game01', 'column1, column2, column3')

    But each column as it's own parameter would be...

  • RE: Table function - list of parameters

    OK, a procedure then.

    It's about lottery. Each lottery game can have different parameters about winning numbers. One such parameter is 'number of numbers you have to select'. So if the...

  • RE: Stored procedure with null parameters

    Thanks, very useful 🙂

  • RE: Help with query

    Works great, I just had to change definition of cteFullRange to:

    Select right('000000000000' + convert(varchar, number), 12)

    from master..spt_values

    where TYPE='p' and number between...

Viewing 15 posts - 31 through 45 (of 64 total)