Forum Replies Created

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

  • Reply To: I have an odd situation that I just can't wrap my head around

    Each location can't be completely separate if email addresses must be unique.  You need to replicate the email addresses across all tables, or have a "master" email table that contains...

    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 Importing NULLs in varchar field

    You could also explicitly define ("format") the column as "Text" data type in Excel.

    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: Either/ Or Query

    Here's a quick way:

    DECLARE @JobDomain int
    SET @JobDomain = 1

    ;WITH cte_Type_B AS (
    SELECT *
    FROM dbo.TestTable
    WHERE JobDomain...

    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: Optimization for Single Table with Thousands of Concurrent Updates

    Is the clustered index on the table on BaseID?

    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: SQL bug

    You can also use:

    '20211130 00:00:00.000'

    The only special chars you need are in the time, no - no T.

    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: STAT command conindex equivalent

    I've never heard of anything like that in SQL Server.

    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: Necessary Insert Columns

    Rune Bivrin wrote:

    Steve Jones - SSC Editor wrote:

    Part of the QotD is knowing defaults. This was left off, as many people do this and the default is to allow NULLs.

    As a good practice, however, I...

    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: Capturing what calls a trigger

    (1) Not guaranteed, but you could try looking at sys.dm_exec_input_buffer.event_info (SQL 2016+ only, I think).  I would issue this command immediately upon entering the trigger, to have the best chance...

    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: How to remove unallocated space after partitioning

    It may fragment some indexes and not others.  You certainly don't want to automatically rebuild every index.  Also, rebuild from smallest to largest of the indexes that do need rebuilt.

    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: Necessary Insert Columns

    Liked Rune's comment.

    And that is why you should always explicitly specify NOT / NOT NULL when creating a table.  From the context of the q, I could work out that...

    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: How to remove unallocated space after partitioning

    Shrink only the file(s) that are part of the PRIMARY filegroup:

    DBCC SHRINKFILE(1, 512)

    DBCC SHRINKFILE(?, 512) --if you have additional file(s) in the PRIMARY fg

    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: Sum Cast to decimal gives wrong totals

    SELECT CAST(SUM(OrigWeight/2000.0) AS decimal(10,2)) Tons

    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: Search for Global Temp tables in multiple stored procedures

     

    SELECT OBJECT_NAME(object_id) AS object_name
    SUBSTRING(definition, CHARINDEX('##', definition) - 20, 200) AS definition_first_match,
    definition
    FROM sys.sql_modules
    WHERE definition LIKE N'%##%'
    ORDER BY 1

    Edit: Sorry, I...

    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: Why does a select on 1 table end up putting locks on other tables?

    SQL will take only those locks needed to guarantee consistency and accuracy in results.  As Jeff said, the details of that depend, but that is the general approach.

    Is A an...

    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: DENY DELETE to does not seem work for me

    Do you -- the user running the code -- also have sysadmin permission?  If you have sysadmin permission, any DENYs are ignored.

    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 - 601 through 615 (of 7,619 total)