Forum Replies Created

Viewing 15 posts - 151 through 165 (of 7,619 total)

  • Reply To: Searching for the Assumed Full Backup

    1 NO

    2 It isn't.  Multiple types of file can be sent a single physical file in SQL Server backups.

    3 Look for the last full ('D') backup immediately preceding the '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: OLA's Maintenance scripts - should I be reorganizing?

    Only do ONLINE rebuild if you really need it.  It has additional overhead and is often not quite as efficient as packing data rows.

    Data (page) compression is a great tool...

    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: SSIS Visual Studio 2022: Trying to avoid linked servers using SSIS

    I suggest not working with partial days.  Therefore, I suggest changing the first query to:

    SELECT * FROM dbo.SQL_SOURCE WHERE Mod_Date >= CAST(CAST(Getdate() AS date) AS datetime) -5

    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: Prevent overwriting of a database while Restoring manually

    I think there should be an explicit "NO REPLACE" option, but MS doesn't have it.

    Instead, you can check for the db exiting before you issue the RESTORE DATABASE command:

    IF EXIST(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: Return string between parentheses

    SELECT
    UserGroup.[Name]As GroupName,
    UserGroup.[Description]As GroupDescription,
    Domain
    FROM [dbo].[UserGroup]
    CROSS APPLY (
    SELECT NULLIF(CHARINDEX('(', Name), 0) AS start_of_substring,
    ISNULL(NULLIF(CHARINDEX(')', Name), 0), LEN(Name) + 1) AS end_of_substring
    ) AS ca1
    CROSS APPLY (
    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: Return string between parentheses

     

    DROP TABLE IF EXISTS #data;
    CREATE TABLE #data ( string varchar(8000) NULL );
    INSERT INTO #data VALUES( 'Domain Administrators (abc.domain.com) Group Members'),
    ('Engineering Supervisors (xyz.domain.com)...

    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: View works for me ...but doesn't return results for a user in SSMS but no errors

    Do you mean "sysadmin" (vs. "dbadmin").  SQL is very selective about who can see jobs.  If you didn't create the job and aren't sysadmin, you don't typically see the job. ...

    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 get a distinct value from my data set

    SELECT ColumnA

    FROM dbo.your_table

    GROUP BY ColumnA

    HAVING COUNT(DISTINCT ColumnB) = (SELECT COUNT(DISTINCT ColumnB) FROM dbo.your_table)

    ORDER BY ColumnA

    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 Approach Adding A primary Key To An Existing Table

    My main advice would also be not to modify the table structure unless you really need to (I deliberately put the code in comments that (if you wanted to) changed...

    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 Approach Adding A primary Key To An Existing Table

    It's nice that there's already an index on dDateIn. I would suggest something like this:

    --Setup

    (A1) Create a new table, with a usable clustered index. Add data compression to the 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: How To Approach Adding A primary Key To An Existing Table

    If the table is just a heap (you said there's no PK, but that doesn't necessarily mean there's no clustered index), as you know, you'll have to rewrite the whole...

    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: Deadlocks with UPDATE statements using serializable transaction isolation level

    I think if you do the UPDATE and lookup all in one go, you won't have dups nor deadlocks:

    ...

    UPDATE dbo.Reference_Numbers
    SET @NextReferenceNo = NexNextReferenceNo = NextReferenceNo + 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: Sessions and CPU Threads

    No.  If they're sleeping, and don't have any active tasks, they are not using up CPU.  They are taking a small amount of memory.

    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: UPSERT question for performance and efficiency

    I've generally found MERGE to be less efficient than UPSERT.  Others maybe not.

    You could generate the necessary WHERE clauses and CASE clauses to conditionally UPDATE 200 columns.

    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: Order By on a single table raises Ambiguous column name error

    Because * SELECTs all columns, which would include hMy.  Try this instead:

    SELECT hMy, *
    FROM dbo.WF_HEADER
    WHERE 1=1
    ORDER BY 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".

Viewing 15 posts - 151 through 165 (of 7,619 total)