Forum Replies Created

Viewing 15 posts - 1,111 through 1,125 (of 1,228 total)

  • RE: Complex T-SQL query

    lmu92 (3/6/2010)


    clive-421796 (3/6/2010)


    Would like to hear from the likes of Jeff Moden, Lynn Pettis, etc. if they have a solution for this.

    I'm by far not at the level of Jeff...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Very complex - How to count difference data

    Here's a CROSS APPLY version of Jeff's derived table solution:

    drop TABLE #AAATable

    CREATE TABLE #AAATable(

    [col1] [int] NULL,

    ...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: TSQL query problems

    There are two distinct stages to this problem, data selection, then transformation. This query makes a start on data selection based on Lutz' suggestion of using ROW_NUMBER():

    DROP table #Accounts

    create table...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Subquery in case statement

    vbprogrammer1986 (3/3/2010)


    Can Also Use Top .

    TOP1, preferably with ORDER BY regardless of whether or not the returned values are the same. Just good practice.


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Subquery in case statement

    Run this part:

    select adminpermission from appadmin where addId=1

    If the returned values are different, then you will have to decide which to use, using MIN()/MAX() or ROW_NUMBER() with OVER() or GROUP...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Help with CASE statement in my query

    lmu92 (3/2/2010)


    Why not joining the temp table directly to the query?

    Something like

    SELECT *

    FROM cElements A

    LEFT JOIN sectionList D ON D.sectionID = A.sectionID

    LEFT JOIN fList E ON E.fID...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Help with CASE statement in my query

    Magy (3/2/2010)


    It is an ugly query...I know

    In English it would be like:

    Is 2006 in the temp table? Then add this to the query....

    Is 2007 in the temp table? ...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Get Similar recordes base on usage and matching criteria

    pritesh-807803 (3/1/2010)


    My input and output values are there in attached excel.

    Pritesh, I know you've provided sample data in a spreadsheet, but I simply don't have the time to turn the...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Get Similar recordes base on usage and matching criteria

    pritesh-807803 (3/1/2010)


    Hi Chris,

    My above posted query is wroking fine. I have problem with order by Status.

    I wand distinct CandidateIDs from Candidate and CandidateProject table where i want to give...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: sp_executesql doesn't pass parameters, exec does

    ma-516002 (2/28/2010)


    Don't know what happened there. I recreated the database and everything works now 🙂 (Gremlins?)

    Well done - but your observation that rebuilding the db solved the problem is almost...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: sp_executesql doesn't pass parameters, exec does

    ma-516002 (2/28/2010)


    No, your suggested command has the same result as the auto generated one, an empty table.

    This looks like there is something missing to sp_executesql or the target procedure in...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: sp_executesql doesn't pass parameters, exec does

    ma-516002 (2/28/2010)


    No, your suggested command has the same result as the auto generated one, an empty table.

    This looks like there is something missing to sp_executesql or the target procedure in...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: sp_executesql doesn't pass parameters, exec does

    ma-516002 (2/28/2010)


    That statement is generated by System.Data.Common.DbCommand, you cannot modify it.

    Thanks for the extra info.

    I think the problem is with setting up the command string in your interface code....


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: sp_executesql doesn't pass parameters, exec does

    ma-516002 (2/28/2010)


    I have a stored procedure which expects a few parameters, all have a default value. The procedure returns a table, that is it ends with SELECT ... FROM. I...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Fast random row selector

    Jeff Moden (2/26/2010)


    Hmmmm.... that gives me an idea... Thanks, Chris.

    You're welcome Jeff - it's always interesting to see what surprise you pull out of a hat when you have one...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

Viewing 15 posts - 1,111 through 1,125 (of 1,228 total)