Forum Replies Created

Viewing 15 posts - 1 through 15 (of 7,634 total)

  • Reply To: Weird problem altering logins with sysadmin account

    Are you trying to change a login or a user?  The command you used was for a user, so that user would have be in the current db.

    To REVOKE 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: Trying to make this faster using not exists

    As in your original query.  If the query plan shows an issue, put the claim_procedure_ids in a table and then use a NOT EXISTS against that table.  For example:

    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 make this faster using not exists

    There's nothing linking the NOT EXISTS to the main query.  The subquery is running by stand-alone, finding an id(s) that do exist, and so the "NOT EXISTS" is failing.

    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: Slow - Linked server query

    For example, if practical:


    EXEC('DROP TABLE IF EXISTS tempdb.dbo.k_sub_remote_query; CREATE TABLE tempdb.dbo.k_sub_remote_query ( claim_id int NOT NULL, claim_procedure_id int NOT NULL, PRIMARY KEY ( claim_id, claim_procedure_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: Slow - Linked server query

    Can't be sure without a query plan, but odds are you'd be much better off running it on the remote server; SQL Server is likely copying the entire tables from...

    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: Perfermance result aftet purge operatio

    It's true that single seeks will see no difference from a reduction in data.

    However, a seek and scan will still benefit.

    Yes, overall you should see improvement.  If you have 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: Trigger isn't working

    1.  OK, but the "inserted" table in the trigger should be joining to the same table name as the trigger is fired on, right?, on the source table, not on...

    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: Trigger isn't working

    2 qs:

    1. Shouldn't you be joining on the ID = ID and not on ID = images?
    2. Is it possible that [Front Image Alarm Status] can be NULL?  If 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: Force join by longest possible choice

    You're welcome!  Very glad it helped.  Thanks for the nice feedback.

    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 Storage Optimization: Multiple Files in a Filegroup vs Dedicated File

    Honestly, I think the biggest payback will be from page compressing the data (whether you use separate filegroups or not).

    As always, it's vital to have the best clustered index on...

    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: Force join by longest possible choice

    For example,

    SELECT t1...., ca1....
    FROM dbo.table1 t1
    CROSS APPLY (
    SELECT TOP (1) ...
    FROM dbo.table2 t2
    WHERE t2.column LIKE...

    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: Force join by longest possible choice

    Yes.  Use a CROSS APPLY or OUTER APPLY (rather than a JOIN) with a TOP (1) ORDER BY LEN(<matched_column>) DESC

    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: A design question in a parent child relationship

    b) there could be an issue if the flag in the Task table doesn't match the data in the vendors table. In other words, if the task is marked complete,...

    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: A design question in a parent child relationship

    Option 1 has performance issues.

    Not necessarily.

    Qs:

    1. Are all Vendors added to the Task when the Task is created, or can Vendors be added later?
    2. Can a Task be "Uncompleted"?  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: Querying Multiple Tables for the Same Information

    Dynamically create a view that references all the applicable tables at the moment your code started running.

    For example, roughly like this.  [Edits in italics] You didn't give any real details...

    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 through 15 (of 7,634 total)