Forum Replies Created

Viewing 15 posts - 796 through 810 (of 1,082 total)

  • RE: Analytical Interview Questions

    Hi,

    Thanks all for the replies, some very interesting thoughts and ideas 🙂

  • RE: Multiple criteria (COUNT(DISTINCT(*) in select statement

    Not sure about everyone else.

    But tend to find it easier to design a db then write queries on it.

    You need to decide what data you want to store and weather...

  • RE: Outer joins to inner joined tables - CTEs best?

    HI There,

    It's still going to be pretty hard to give advise without knowing the relationship between the 4 tables.

    Could you give us an example such as.

    CREATE TABLE [TableA]

    (....)

    CREATE TABLE [TableB]

    (....)

    CREATE...

  • RE: Random number generator within an UPDATE query

    Hi ,

    This seemed to work for me:

    SELECT

    CatA = (CASE WHEN (Cat = 'CatA') AND

    (CAST(RAND(CAST(NEWID() AS VARBINARY))*6+1 AS INT) >= RNG) THEN CatA+1 ELSE CatA END),

    CatB = (CASE WHEN...

  • RE: Problem using 'EXEC (sSQL)

    Hi,

    I hope this helps explain:

    --OUT SIDE EXAMPLE

    DECLARE @sql VARCHAR(4000)

    CREATE TABLE #tmp

    (Id INT)

    INSERT INTO #tmp VALUES(1)

    SET @sql = 'INSERT INTO #tmp VALUES(2)'

    EXEC (@SQL)

    SELECT * FROM #tmp

    DROP TABLE #tmp

    --INSIDE...

  • RE: Problem using 'EXEC (sSQL)

    Hi,

    The Table #Temp is not in the correct scope.

    If it is created outside the dynmaic sql batch then it will only be accesible outside the dynamic batch.

    If you create it...

  • RE: Outer joins to inner joined tables - CTEs best?

    HI there,

    It will be hard for us to tell why your CTE returned different results to your tempory table, without actually seeing the code for the creation of the two...

  • RE: sp_executesql

    Wow that was driving me crazy.

    the variable:

    @params is too short so it's causing everthing to fall over.

    Extend the length and all should be sorted 🙂

  • RE: sp_executesql

    Sorry , my bad, I have all the data I need 🙂

  • RE: sp_executesql

    OK I don't get the same error, but here is what I think.

    If any of your variables that help build your string are null then it will all fall over.

    I...

  • RE: sp_executesql

    what error are you getting?

  • RE: Odd insert problem

    rbarryyoung (7/23/2008)


    Well I don't have enough details to do anything exact, but assuming that they are only using 5 digits in that Varchar(12) field, then something like this ought to...

  • RE: Return the most frequent value

    Hi Jeff,

    I was just thinking about us all returning different columns etc.

    I've tested it with the same columns of AccNum, Id, Address and the results are very similiar.

    Out of interest...

  • RE: Return the most frequent value

    HI Chris,

    I have run 2k version on 10000 rows and it takes 3000ms where the 2k5 versions run in sub 50ms

    I tried to run it on a 1Mil but it...

  • RE: CASE WHEN .. THEN .. ELSE .. END

    ooops

    Sorry lazy me, I check BOL, and it seems

    Result Types

    Returns the highest precedence type from the set of types in result_expressions and the optional else_result_expression. For more information, see Data...

Viewing 15 posts - 796 through 810 (of 1,082 total)