Forum Replies Created

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

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

  • Reply To: Search for Global Temp tables in multiple stored procedures

    Search for '##' in the text of the proc.  The only real reason that string should be in there is to reference a global temp table.

    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: Remove duplicate data from PRIMARY Filegroup

    The PARTITION SCHEME tells SQL which filegroups to use for the partitions.

    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: Some questions about improving performance of Update query in SQL

    frederico_fonseca wrote:

    ScottPletcher wrote:

    frederico_fonseca wrote:

    ScottPletcher wrote:

    There are a number of restrictions and possible gotchas with filtered indexes.  In theory they are great, in practice they can be difficult.

    would you care to...

    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: Some questions about improving performance of Update query in SQL

    frederico_fonseca wrote:

    ScottPletcher wrote:

    There are a number of restrictions and possible gotchas with filtered indexes.  In theory they are great, in practice they can be difficult.

    would you care to explain exactly...

    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: Some questions about improving performance of Update query in SQL

    There are a number of restrictions and possible gotchas with filtered indexes.  In theory they are great, in practice they can be difficult.

    Until you've had time to fully test out...

    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: Trying to change column collation throws string truncation error

    Are you sure you matched the original data type and length?  For example, if the original columns was varchar(8000) and you specified varchar(4000), obviously data might get truncated.

    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,613 total)