Forum Replies Created

Viewing 15 posts - 1,351 through 1,365 (of 7,619 total)

  • Reply To: Cursor replacement suggestions

    You could do some major clean up on your existing code:

    1. Don't use nvarchar unless you absolutely must have it, use varchar instead.

    2. Don't use (MAX) unless you absolutely must...

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

  • Reply To: Deadlock where victim has two shared locks and blocker two exclusive

    There are only two processes involved in the deadlock.

    Make sure you have an index on

    dvd ( bed_id, wns_id, dvb_id )

    Actually, all these tables should almost certainly be clustered first on bed_id,...

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

  • Reply To: Problem with query that has a date conversion to 'yyyy-mm-dd' format

    ...

    N'<th>Count of Records Successfully Uploaded Today: </th></tr>' +

    -- Below is the query of which the results are passed into the rectangle

    CAST((SELECT COUNT(*) FROM .[dbo].[Stage_SMSLog]

    with (NOLOCK) WHERE datestamp = CONVERT(nvarchar(10), GetDate(),120))...

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

  • Reply To: Problem with query that has a date conversion to 'yyyy-mm-dd' format

    You need format 120 rather than 20: 20 will leave off the century, so you'd get 21 for yy instead of 2021, therefore it won't match.

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

  • Reply To: Update a table with inserted value of another table

    A trigger would be more consistent than using a proc, unless you only want to do this for certain, specific INSERTs:

    USE tempdb;

    IF OBJECT_ID('dbo.FirstTable') IS NOT NULL
    ...

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

  • Reply To: convert time for daylight saving ..UTC to EST

    AT TIME ZONE clause.

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

  • Reply To: Any ways to unify messy input?

    I think Google has some type of API that does address correcting.

    I'd look for that or some other known app to do this.  What you're trying to do is way...

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

  • Reply To: Cursor replacement suggestions

    Bruin wrote:

    Would it help if I post Capture_Inline_Quality ? 

    Yeah, we can't anything to improve things without seeing that code.

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

  • Reply To: Customers count on first of the month report

     

    DECLARE @first_sales_month date = '20200101'
    DECLARE @last_sales_month date = '20201201'

    SET @first_sales_month = DATEADD(MONTH, DATEDIFF(MONTH, 0, @first_sales_month, 0)
    SET @last_sales_month = DATEADD(MONTH, DATEDIFF(MONTH, 0, @last_sales_month, 0)

    SELECT
    ...

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

  • Reply To: What does "SET XACT_ABORT ON" mean?

    I suggest you always explicitly set XACT_ABORT, either ON or OFF.  After that, you just need to understand the implications of  the XACT_ABORT setting.

    If it's OFF, you may have parts...

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

  • Reply To: Loop thru DIRs and COPY latest BAK file to our DR Dir

    SQL creates a table entry for all db backups.

    Look in table "msdb.dbo.backupset" to find the lastest full backup datetime for each db, and link to table "msdb.dbo.backupsetfamily" to find 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".

  • Reply To: Setting data compression on a database or even server level possible?

    You'd want to make sure PAGE compression was actually appropriate for each specific table first.  In certain cases, page compression doesn't do enough good to make it worth SQL's effort...

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

  • Reply To: Nested Join Alternative

    Yeah, those scalar ops can be ignored as far as performance goes, as long as they aren't repeated a million times or so.

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

  • Reply To: Nested Join Alternative

    I would think the subquery would (almost) certainly be able to take advantage of the fact that the query only needs to lookup a single Shipment_No, rather than processing all...

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

  • Reply To: Last Time Stored Procedure Ran ?

    If you don't need the parameters, or they require too much overhead to log, then don't log them.

    Just capture the start time, as a datetime2, and the proc name (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".

Viewing 15 posts - 1,351 through 1,365 (of 7,619 total)