Forum Replies Created

Viewing 15 posts - 4,861 through 4,875 (of 7,615 total)

  • RE: Syntax Errors when Re-Creating Procedure

    Nah, I was thinking of something like this to generate the commands to run. If you want, you could even actually run the code instead of just generating it.

    DECLARE...

  • RE: How can I group near duplicate records under a new common field?

    To me it seems fairly easy to match single rows. Maybe you can just output those matches to a table and then consolidate the like ids using that result.

    SELECT...

  • RE: Execute procedure in procedure?

    Since you literally can't add enough values here to make a cursor all that bad, you might want to use a cursor just to have better control over the processing...

  • RE: Rebuild Index after Transaction log backup

    DECLARE @database_name NVARCHAR(50)

    SELECT @database_name=DB_NAME()

    WHILE 1 = 1

    BEGIN

    IF EXISTS(

    SELECT 1

    FROM msdb.dbo.backupmediafamily

    INNER JOIN msdb.dbo.backupset ON...

  • RE: Syntax Errors when Re-Creating Procedure

    No, you'd need to use a synonym for each object. But it's easy enough to generate the code to create the synonyms for all tables in the current db.

  • RE: Varchar parameter Tinyint search criteria

    Similar to the first option above; you may need to adjust for your specific values:

    AND ((@JobStatus IN ('O', 'o') AND JobStatus = 1) OR

    ...

  • RE: Varchar parameter Tinyint search criteria

    I'd try a combined query, force it to recompile so SQL can ignore the unmatchable condition:

    SELECT JobStatus

    FROM dbo.JCJM

    WHERE

    (@JobStatus IN ('O', 'o') AND JobStatus = 1) OR

    ...

  • RE: DATEADD and leap years

    I prefer just:

    DECLARE @MyDate DATETIME;

    SET @MyDate = '2/28/2009';

    SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, @MyDate) - 11, -1);

  • RE: Receiving Subquery returned more than 1 value Error Why?

    The basic trigger rewrite is easy enough, but trying to return the value is and will be a very severe issue. Returning data directly from a trigger should never...

  • RE: Bitwise Operator (pipe) in Update Statement

    It sets the corresponding bits on, regardless of whether they were on before or not.

    For example:

    SELECT CAST(0 AS int) | 1 | 2 | 4

    SELECT CAST(1 AS int) | 1...

  • RE: Quick GETDATE question

    AND AppDetails.DateDetailDisposed >= Dateadd(Day, Datediff(Day, 0, Getdate()), 0) - 21

    AND AppDetails.DateDetailDisposed < Dateadd(Day, Datediff(Day, 0, Getdate()), 0) - 20 INNER JOIN

  • RE: Index Selection

    mitzyturbo (8/26/2015)

    It doesn't make much sense for such a change in performance as the indexes are rebuilt and stats updated on a nightly basis.

    After an index is rebuilt, you should...

  • RE: Syntax Errors when Re-Creating Procedure

    I'd take a different approach. How about using synonyms to re-direct from the old schema name to the new one? Then you wouldn't have to directly change any...

  • RE: High CPU usage by sql server

    Can't troubleshoot that query without more details on it.

    One specific thing to check, though, is that you have limited SQL's use of RAM via the 'max memory' setting, and not...

  • RE: Duplicate Stats

    It looks like it could be a good, and perhaps overlooked, area for investigation, but I don't fully understand exactly what is being listed/described by the query.

Viewing 15 posts - 4,861 through 4,875 (of 7,615 total)