Forum Replies Created

Viewing 15 posts - 6,601 through 6,615 (of 7,600 total)

  • RE: TRIGGERS...

    "FOR" was used before SQL allowed BEFORE or INSTEAD triggers; there were only AFTER triggers, and the syntax used the word "FOR" instead of "AFTER".

    After other trigger types were added,...

  • RE: How to preserve global temporary table data

    sharky (3/31/2013)


    Lynn Pettis (3/29/2013)


    SQLRNNR (3/29/2013)


    Lynn Pettis (3/29/2013)


    ScottPletcher (3/29/2013)


    The advantage to tempdb is that there is less overhead writing data there since SQL "knows" it never has to recover tempdb.

    Really? ...

  • RE: How to preserve global temporary table data

    The advantage to tempdb is that there is less overhead writing data there since SQL "knows" it never has to recover tempdb.

  • RE: Parse CC in String

    That seems like a reasonable approach. Using REPLICATE() will make it easier to see how many numbers are in the pattern and/or adjust it later:

    WHERE PATINDEX('%[0-9]' + REPLICATE('[0-9 -]',...

  • RE: How to preserve global temporary table data

    Note that you can use a "real" table name in tempdb; that is, a table name that does not begin with # or ##. The table will then remain...

  • RE: Get sum of averages - a challenge

    Until you get to SQL 2012, you also have the "quick-and-dirty" version of that, using COMPUTE:

    SELECT Curr_date, Action, AVG(Duration)/1000 as Avg_Duration

    FROM Table_1

    WHERE Curr_date = CAST(GETDATE() as DATE)

    GROUP BY Curr_date,...

  • RE: data design considerations

    Grant Fritchey (3/28/2013)


    ScottPletcher (3/28/2013)


    There must be more fragmentation in a history table than a current-data-only table.

    For single row lookups, this is not really a performance hit.

    But for table scans, even...

  • RE: Update Help..

    Also, be sure to check: sys.sql_expression_dependencies.

    And not just in its own db but in other dbs, esp. on the same instance.

    And the usual disclaimer: even that isn't guaranteed to be...

  • RE: data design considerations

    There must be more fragmentation in a history table than a current-data-only table.

    For single row lookups, this is not really a performance hit.

    But for table scans, even partial ones, it...

  • RE: Execute SQL in all database

    EXEC sp_MSforeachdb '

    IF NOT EXISTS(SELECT 1 FROM [?].sys.tables WHERE name = N''myTable'')

    RETURN

    SELECT ''?'' AS Db_Name, *

    FROM [?]..mytable

    '

  • RE: Count number of days that a doctor works

    My best guess on the very limited info so far is something like this:

    select MonthName, DocName, count(distinct day(appointment_date)) as days_worked

    from Appointments

    group by MonthName, DocName

  • RE: Any potential issues with putting a Stored Procedure in Master?

    You could easily use master for that. Especially given that you must use master for some procedures anyway. Moreover, it's much easier from SQL2005 on to distinguish your...

  • RE: Query - Please Help!

    sp_MSforeachdb is indeed a cursor, and not a particularly good one.

    Still, it exists, and it's useful for quick-and-dirty tasks sometimes, particularly if you don't have a lot of dbs.

    So, I'll...

  • RE: Alpha Numeric number Generation

    Sean Lange (3/26/2013)


    nitin_456 (3/25/2013)


    So the idea here is to Generate 2 -3 million consecutive unique numbers by using 5 Alpha Numeric digit. Please if you can help around this will...

  • RE: data design considerations

    The main table would still hold the entire current record. Even if the history table contains the current record, you don't want to get it from there because of...

Viewing 15 posts - 6,601 through 6,615 (of 7,600 total)