Forum Replies Created

Viewing 15 posts - 4,306 through 4,320 (of 7,613 total)

  • RE: efficient Querying - NOT EXISTS

    You need to create an index on ID in T2, T3, T4, T5 and T6.

    You should check the tables in the order of most likely to EXIST first, so 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".

  • RE: master, model, msdb

    You can backup the dbs using the commands below from within SSMS or other appropriate SQL utility. Since someone has gone to the trouble to cluster the SQL instance,...

    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: Looking For A Way to Check Data Spread Across Multiple Records; Looping Most Likely Involved

    Using HAVING eliminates a pass of the table and makes it easier to specify different conditions.

    SELECT mt.*

    FROM@myTable mt

    INNER JOIN (

    SELECT ColumnA

    FROM @myTable

    ...

    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: SQL version

    --pull first four digits in a row that start with 2, should be year.

    SELECT SUBSTRING(@@VERSION, PATINDEX('%2[0-9][0-9][0-9]%', @@VERSION), 4)

    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: Having multiple DML triggers on same table

    As always with triggers, the biggest issue is to make the sure the triggers are coded properly, i.e. they deal with sets and not a row at a time, and...

    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: Need guidance...

    First, look into implementing snapshot isolation (SI) for the underlying db(s). If nothing else, if will reduce contention issues while you tune the indexes. Be sure to adjust...

    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: Execution plan

    If "MyOtherTable" has an index on O.ID, add "IsPurged" to the key of that index.

    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: Using reserved words as column names

    I can't imagine any problem with a column named "number", since number is not a reserved word in SQL Server anyway.

    I must admit, I don't generally worry too much about...

    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: strange problem with varchar(8000) getting cut at 4000 characters

    It sounds like:

    at least one nvarchar is working its way into some concatenation or other string operation, forcing the string to become nvarchar, and thus a max of 4000 bytes.

    or...

    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: Help me in executing this CASE Statement

    IF EXISTS(SELECT 1 FROM dbo.ShiftScheduler WHERE ShiftType=2 AND Emp_Code='2414')

    SELECT FromDate,enddate,Shift,ShiftType

    FROM dbo.ShiftScheduler

    WHERE ShiftType = 2 AND EndDate...

    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: Recursive Table - Query Help

    Try code something like below.

    Btw, the GroupAssignment table does not need an identity column. The unique clustering key should be either ( GroupID, UserID ) or (...

    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: Determine ANSI_PADDING status in TSQL

    Fwiw, I prefer the a different way to check the current ansi / connection settings, using:

    @@OPTIONS

    I actually use a table of config values so the code is more readable, but...

    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: IF, THEN in T-SQL?

    You can use CROSS APPLY to assign an alias name to value(s). You can then use that alias in subsequent code, even in another CA. That is, alias...

    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: why we should delete old data and what could be the chunk size for delete 2.5 million records

    If the table is clustered first on that datetime, the purge is easy and it should have very minimal effect on current queries.

    If it's clustered differently, you have a more...

    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: sql swap dated fields

    You probably want to verify that the dates are actually backwards before swapping them:

    update tableA

    set StartDate = EndDate,

    ...

    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 - 4,306 through 4,320 (of 7,613 total)