Forum Replies Created

Viewing 15 posts - 8,191 through 8,205 (of 26,490 total)

  • RE: Cursor in Stored Procedure

    opc.three (4/1/2013)


    mister.magoo (4/1/2013)


    Lynn, Nope that pretty much sucks too! :hehe:

    Lynn's numbers seem off to me. I got ~10s for your method and ~50ms for Lynns. But Lynn's numbers make it...

  • RE: SQL exercises for job applicants

    Jeff Moden (4/1/2013)


    LutzM (3/11/2012)


    I like the FizzBuzz puzzle.

    I use it to identify if an applicant

    - prefers using a set or loop based method where both methods are possible

    - knows...

  • RE: Cursor in Stored Procedure

    opc.three (4/1/2013)


    I'll give you the @objtype change as something to be corrected, and the second as I just reread ap_rename. Now, how to deal with multiple schemas??

    Without testing, does...

  • RE: Cursor in Stored Procedure

    opc.three (4/1/2013)


    That seems to be a function of continually updating an NVARCHAR(MAX) which does not scale linearly. It gets truncated so it's worthless to use it but if you run...

  • RE: Cursor in Stored Procedure

    mister.magoo (4/1/2013)


    Lynn Pettis (4/1/2013)


    Yea, but I think I'll stick with the FOR XML Version, the following was done against a database with 5147 tables in sys.tables:

    ---------- opc.three verison ----------

    Beginning execution...

  • RE: Cursor in Stored Procedure

    opc.three (4/1/2013)


    I use a slightly different method to avoid some of the entitization problems FOR XML brings with it. Technically it is an undocumented method that I know of but...

  • RE: A severe error occurred on the current command. The results, if any, should be discarded.

    Do each of the CTE's run as standalone queries?

  • RE: Google Glass Your Database

    Sigerson (4/1/2013)


    I was speaking to my nephew while visiting for Easter. He is in school for electrical engineering. One point that came up is the story of how...

  • RE: Why is Output parameter null?

    Lowell is correct.

    create procedure TestOut

    @P1 varchar(256),

    @p2 varchar(MAX) OUTPUT

    as

    if @p1 = 'Y'

    set @p2 = 'Yes'

    else

    set @p2 = 'Not Y'

    go

    declare @p2 varchar(max)

    exec Testout 'Y', @p2 output

    if @p2 IS NULL

    print 'nothing'

    else

    print 'P2 is...

  • RE: Sum then Divide

    Based on what you posted:

    declare @t_complete int = 176420,

    @myCount int = 5265365;

    select @t_complete / @mycount, @t_complete / (@mycount * 1.0)

    Results:

    IntDivision ...

  • RE: Sum then Divide

    ccmret (4/1/2013)


    Still provides 0's. The numbers that I am trying to divide are:

    t_complete = 176420

    Count = 5265365

    Format is tinyint.

    Thoughts?

    Please explain what you mean by format is tinyint?

  • RE: Script to calculate when a job ended.

    Welsh Corgi (4/1/2013)


    Well thank you. That is nice but I'm looking for is the Start Datetime, End Datetime and elapsed time for each step for a single job.

    Yes, and the...

  • RE: Cursor in Stored Procedure

    Erin Ramsay (4/1/2013)


    I concede that this task can be done with a set-based command that generates a list of commands.. lol.. now let's consider a moment.

    Now consider your task...

  • RE: Sum then Divide

    ccmret (4/1/2013)


    The query successfully completed with your suggestion. Howerver, it returned a zero.

    Integer math, try:

    SUM(t_complete)/(COUNT (*) * 1.0) As Percent_Complete

  • RE: Cursor in Stored Procedure

    Sean Lange (4/1/2013)


    Erin Ramsay (4/1/2013)


    AndrewSQLDBA (4/1/2013)


    SQL Server does not Loop thru rows. SQL Server is Set Based.

    Please do not indicate that a database loops thru rows.

    Andrew SQLDBA

    🙂

    Give me a set...

Viewing 15 posts - 8,191 through 8,205 (of 26,490 total)