Forum Replies Created

Viewing 15 posts - 856 through 870 (of 7,613 total)

  • Reply To: Database Log File

    Not that I know of.

    You could increase the log size to match the size it was originally if you wanted to.  That may take some time as log space 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: Alter Huge Table

    I'll assume that when you refer to "primary index" on the original table you mean "clustering index".  That is critical for copying the data (whereas a (nonclustered) primary key is...

    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: Iterate and reorganize subset of database tables

    Why are using this setting: SORT_IN_TEMPDB = OFF?

    That's generally a very bad idea overall, esp. for larger indexes.

     

    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 help with Pivot

    I would think you'd want the last Response rather than just picking one seemingly at random (as in your results) or the value that happened to be the MAX one...

    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: Looking for some guidance on avoiding Scalar UDFs for DB lookups

    You should get rid of the local variable as it's not needed and causes overhead.  Also, make sure that ANSI_NULLS and QUOTED_IDENTIFIER are set properly when the function is created.

    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: Looking for some guidance on avoiding Scalar UDFs for DB lookups

    If you have 200 entries, at least use a form of binary search rather than searching sequentially thru the list.  Even better would be just looking it up in a...

    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: Fill missing rows in dataset

    ;WITH cte_distinct_customer_regions AS (
    SELECT DISTINCT Customer_Key, Customer_Name, Component, Region
    FROM Fill_Gaps
    )

    SELECT
    cdc.Customer_Key, cdc.Customer_Name, cdc.Component, cdc.Region,
    ...

    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: Transactions names meaning In Transaction Logs

    SQL Server has a system view, sys.dm_db_file_space_usage.  In that view is column modified_extent_page_count, which tells how many db pages have been modified since the last full db backup.  If you...

    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: Backup by specified date interval

    No, not directly from SQL Server anyway.  SQL has no mechanism to allow only certain parts of data in a table to be backed up.

    You back up databases (or filegroups,...

    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: Indexing

    Look at the usage stats for the indexes to see if they are useful (and/or more useful than not).

    There's no single number of max indexes for a table.  It depends...

    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: Query help

    Didn't have usable data to test with, so the code is untested:

    SELECT A.Name, A.DateOfBirth, ot.Count
    FROM TableA A
    CROSS APPLY (
    SELECT TOP (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".

  • Reply To: How to handle sticks on column country1 and country2 columns ?

    Your structure should be normalized, as you stated.

    create table #countries

    (

    company int,

    [year] int,

    rev int,

    country_sequence smallint,

    country varchar(100)

    )

    (12011,2010,121,1,'Egypt')

    (12011,2010,121,2,'France')

    ,,,

    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: Looking for some guidance on avoiding Scalar UDFs for DB lookups

    We need to see the actual lookup code to offer more specific advice here.

    Proper indexing could also be critical to getting best performance for this task.

    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 server enterprise edition or standard

    Jeff Moden wrote:

    It's probably a bad idea all the way around anyway.  🙁  How many people do you know that actually have a "Baseline" to compare against?

    For me, it would work...

    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: Disabling backup Jobs

    You have the general structure for that, you just had a typo in the SELECT for the cursor.  You had:

    DECLARE job_cursor CURSOR READ_ONLY FOR

    SELECT @job_name, [enable]

    FROM #JobsToDisableEnable

    @job_name will contain 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".

Viewing 15 posts - 856 through 870 (of 7,613 total)