Forum Replies Created

Viewing 15 posts - 6,451 through 6,465 (of 7,608 total)

  • RE: Returning stored procedure results into a CTE or temp table?

    INSERT INTO #tempTable

    EXEC dbo.someStoredProc

  • RE: Year to Date Query ... By month?

    Here's one way:

    SELECT

    DATEADD(MONTH, DATEDIFF(MONTH, 0, c.month), 0) AS Month,

    SUM(c.sales) AS Month_Sales

    INTO #Monthly_Totals

    FROM dbo.Car c

    WHERE

    c.month >= '20120401' AND --chg...

  • RE: MAXDOP query hint doesn't work- SQL 2008R2 Enterprise Edition

    What are the results of this query:

    SELECT

    cpu_count / hyperthread_ratio AS CPUs, *

    FROM sys.dm_os_sys_info

  • RE: Shrink does not release space

    Data compression should also be considered, if on Enterprise Edition. [My company has some extremely large audit/logging tables that are rarely read. After compressing them, I often shrink...

  • RE: Shrink does not release space

    Sometimes a database file shrink is indeed needed.

    Shrink does not automatically fragment every index. Absolutely you should test for fragmentation after the shrink, and rebuild accordingly, i.e., basically run...

  • RE: Design question

    You should also consider putting the quarter as the first key column of the clustered index. Then you won't need to partition in any way as long as you...

  • RE: Automated Data Comparison?

    Change Tracking or Change Data Capture also might be useful, depending on your specific requirements.

  • RE: left join question

    In the context of a LEFT JOIN, yes, the queries would return the same rows from TableA (although, as noted, they might appear multiple times because of the join).

    That is,...

  • RE: Indexes

    You shouldn't have any direct issues from doing that.

    First, drop the existing nonclus index, then create the clus index.

    Build the index ONLINE if at all possible, to minimize disruption to...

  • RE: Sanity Check - Disable and re-Enable a Trigger in a Sproc

    Instead of constantly disabling/enabling the trigger, you can set RECURSIVE_TRIGGERS off for the db, unless you really need recursion for other triggers. In that case, you can use CONTEXT_INFO...

  • RE: Triggers on Tables

    I think DISABLE is far more dangerous, since it applies to every task modifying the table.

    Instead you can use CONTEXT_INFO to selectively exit the trigger / skip all/part of the...

  • RE: Trying to iteratively use PATINDEX commands to comb through a large amount of text

    The code uses LIKE to compare the string, so just construct your string accordingly.

    For example, you could use 'ls-' as the search string. Or, if you want a closer...

  • RE: Identify string or integer

    EXEC Stored_procedure1 ('abc')

    EXEC Stored_procedure1 ('123')

    EXEC Stored_procedure1 ('abc112')

    Yes. The core of the logic is this:

    CASE WHEN <string_value> LIKE '%[^0-9]%' THEN <string> ELSE <int> END

    For example:

    SELECT

    data,

    ...

  • RE: Triggers on Tables

    cdl_9009 (8/14/2013)


    Is there a way to turn a table trigger off in a stored procedure, then turn it back on after it skips that table.

    We have the trigger in place...

  • RE: Trigger JOBS

    Assuming the account running "JobA" has the authority to start jobB, the command in JobA would be:

    EXEC msdb.dbo.sp_start_job 'JobB'

Viewing 15 posts - 6,451 through 6,465 (of 7,608 total)