Forum Replies Created

Viewing 15 posts - 6,226 through 6,240 (of 7,613 total)

  • RE: Using Wildcards to locate middle only results

    Instead of the overhead of a self-join, try this for case #3:

    WHERE

    myField LIKE '_%' + @SearchParameter + '%' AND

    CHARINDEX(@SearchParameter, myField) >...

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

  • RE: whats in the buffer pages

    A "heap" is a table without a clustered index. It may or may not have nonclustered indexes.

    You should review heaps carefully. Typically it's far better 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".

  • RE: Question With Creating After Trigger

    Here's my suggested code for this trigger.

    CREATE TRIGGER [dbo].[MAYTABLE_A_IUD_WD]

    ON [dbo].[MYTABLE]

    AFTER DELETE, INSERT, UPDATE

    AS

    SET NOCOUNT ON;

    DECLARE @action char(6)

    ...

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

  • RE: restrict a specific login for a specific amount of time?

    N/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".

  • RE: How to avoid subquery here with this query , please...

    Please try code below. I didn't have any data to test it first, of course.

    SELECT

    a.ValetNO AS PlanNo,

    cross_apply_1.Status1,

    ...

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

  • RE: column with data type of csv list?

    bkmooney (2/13/2014)


    By using a table (and adding a csv list id, and a sequence number) won't I be tripling the size of the data that is required to be stored?

    Perhaps....

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

  • RE: column with data type of csv list?

    I'd still use a table. You just need to add some type of csv list id and a sequence #.

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

  • RE: Query help

    If the function just removes an optional trailing '-' followed by other chars, you can avoid a function completely using CROSS APPLY:

    UPDATE ts

    SET

    Col1 = CASE WHEN...

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

  • RE: Transaction - No transaction or savepoint of that name was found.

    amy26 (2/11/2014)


    Removing the transaction name does not rectify the situation.

    The only thing that I could think of was we do have an if statement that calls another stored procedure...

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

  • RE: Indexes ( one without include, one with include)

    The single index with the included columns can handle queries for both ProductKey alone and for ProductKey and one/both of the included columns. That means you only need 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".

  • RE: Multiple inserts in a single trigger

    CREATE TRIGGER [dbo].[tr_a] on [dbo].[A]

    AFTER UPDATE

    AS

    SET NOCOUNT ON

    BEGIN TRY

    IF UPDATE(STATUS)

    BEGIN

    INSERT INTO dbo.B

    (

    col0,

    col1,

    ...

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

  • RE: Daily Comparison of Tables Tips & Tricks (Merge, Union, uniqueidentifiers)

    Look at Change Tracking; it can identity changes vastly more efficiently than what you're doing now.

    If you're on Enterprise Edition, also look at Change Data Capture, which gives you "point-in-time"...

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

  • RE: Transaction - No transaction or savepoint of that name was found.

    You most likely do have nested transactions, either implicitly or explicitly.

    Just remove the transaction name from the ROLLBACK, which is not meaningful for SQL Server anyway:

    ROLLBACK TRANSACTION /*UPDT_DATA*/

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

  • RE: Indexes ( one without include, one with include)

    You need to run these commands (or the equivalent). Run them online if possible, and using tempdb for sort if possible:

    DROP INDEX [IX_PurchaseOrderDetail_ProductKey] ON [dbo].[PurchaseOrderDetail]

    CREATE NONCLUSTERED INDEX [IX_PurchaseOrderDetail_ProductKey]...

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

  • RE: Maintenance Plan

    george sibbald (2/7/2014)


    ScottPletcher (2/7/2014)


    No real DBA would ever use a maintenance plan;

    thats a bit over the top surely?

    Nowhere does it say using maintenance plans per se is not...

    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 - 6,226 through 6,240 (of 7,613 total)