Forum Replies Created

Viewing 15 posts - 6,991 through 7,005 (of 7,597 total)

  • RE: Change column from NVARCHAR to VARCHAR...

    Since you have to ALTER columns only one at a time (why, MS, why??), I'd create a new table and INSERT every row into it, converting every column at one...

  • RE: IF statement with subquery problem

    sp_MSforeachdb is convenient, but it has huge overhead and is probably overkill for what you need.

    You can use sp_executesql to return a value from dynamic SQL, albeit that it's not...

  • RE: Missing Indexes on Temp tables

    TheSQLGuru (12/16/2012)


    My statement about making "queries" faster is about the ENTIRE process. The act of populating a temp table with an index already on the temp table before data...

  • RE: Grouping by time - can't figure this out!

    If I understand correctly, maybe something like below.

    [Btw, as a general performance guideline, make sure the datatype of the time in the table exactly matches your list of times. ...

  • RE: Value of column dependent on the values of others. How can I do it . Please help !

    And don't forget about computed columns. You can make this a computed column, so you don't have to have the generating code in a trigger. Since it's a...

  • RE: Missing Indexes on Temp tables

    I disagree completely.

    I've repeatedly gotten huge performance gains sometimes by indexing temp tables properly. They are tables like any other table, after all. For large tables, I've seen...

  • RE: Need easy way to make 3 lines per child

    You could also use an INNER JOIN to a hard-coded table:

    select

    case parents.whichParent when 'father' then s.father when mother then s.mother else s.parent_guardian end,

    ...

  • RE: Finding combinations of values

    CELKO (12/14/2012)


    [ Yiikes, that's incredibly convoluted. What a royal pita to try to understand, much less change or debug later!!

    But it is fast and portable 😀

    On a more serious...

  • RE: Finding combinations of values

    CELKO (12/14/2012)


    .. Total failure.. Besides which, I believe my earlier post was the same idea, except coded correctly 🙂 .

    Yeah, it was awful! :crazy:

    What I wanted to do was...

  • RE: Need help with a query

    Sorry, I didn't have test data so I couldn't pre-test it myself.

    If you'll post some data as INSERT statements, I'll be happy to correct the query.

  • RE: Finding combinations of values

    GSquared (12/14/2012)


    CELKO (12/13/2012)


    My table structure

    Please read just one little book on SQL and RDBMS. Please, just one little book! This is not a table; it has no key;...

  • RE: Finding combinations of values

    CELKO (12/13/2012)


    My table structure

    Please read just one little book on SQL and RDBMS. Please, just one little book! This is not a table; it has no key; it...

  • RE: Need help with a query

    SELECT object_name, database_name, DATEPART(Week, event_time) AS EventWeek, SUM(sequence_number) AS [#TimesAccessed],

    DATEADD(HOUR, DATEDIFF(HOUR, 0, event_time), 0) AS [EventHour]

    INTO #EventHour

    FROM ...

  • RE: Query for a plus sign

    ScottPletcher (12/12/2012)


    CELKO (12/11/2012)


    In COBOL, the display and the internal format of data was the same. Each field had a PICTURE clause to define it. Your question makes sense only in...

  • RE: Purging Data Increases IO performance?

    It's normal IF the indexing on the data was not optimal, so that you were scanning old data before that has now been removed.

    Note that when you DELETE a large...

Viewing 15 posts - 6,991 through 7,005 (of 7,597 total)