Forum Replies Created

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

  • 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...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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

    ...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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

    ...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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);

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: One of the most complex Views i have ever seen (View nested into another view)

    SQLPain (8/25/2015)


    Thanks for the fast reply.

    the current result set contains only 500 values, I don't think it would ever go higher than that. what would be the difference in the...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Stored Procedure runs fine on the Production Server and two Test Server but not on the replicated Server.

    Check the statistics on the replicated server, make sure they are current (or at least as current as the other servers).

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

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