Forum Replies Created

Viewing 15 posts - 6,196 through 6,210 (of 7,619 total)

  • RE: Adding dummy values

    I think you're looking for LEFT OUTER JOIN, something like this:

    SELECT

    c.CaseID, c.Resolution,

    COALESCE(CAST(s.CaseID AS varchar(10)), 'DUMMY-' + c.Resolution) AS SubCaseID

    ...

    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: Specific Sprocs vs general get all sprocs

    I don't see any need for a pre-built proc for:

    Get All of Foo

    Just SELECT the columns you need from the table instead.

    For the rest, if you're willing to use dynamic...

    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: Tempdb is full for Large Table Joins

    Based on the query plan, I think two these things 100% need done and should help:

    1)

    Table: SubOrderTrans

    Index: idx_subordertransday

    INCLUDE column SubOrderTransDeleted in that index

    2)

    Table: SUBORDER_ETA_CORRECTIONS

    Index: IDX_NC_SubOrderID

    Change it to a clustered 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: Retrieve last 7 days date question

    Current query is not SARGable and is somewhat convoluted as well.

    SELECT DISTINCT TOP 7

    Convert(DateTime, Datediff(Day, 0, DateCreated)) AS DateCreated,

    Datepart(dw,DateCreated) AS WeekNum...

    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: Tempdb is full for Large Table Joins

    Grant Fritchey (3/25/2014)


    ScottPletcher (3/25/2014)


    Grant Fritchey (3/25/2014)


    ScottPletcher (3/25/2014)


    Grant Fritchey (3/25/2014)


    I can't see the query since it exceeds the size of what's stored in the plan, so suggestions from the plan alone...

    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: Working with stored text file in TSQL

    Roughly like below. You may have to adjust the "SINGLE_NCLOB" to "SINGLE_CLOB", depending on the format of the input file.

    DECLARE @file_text varchar(max)

    SELECT @file_text = file_text

    FROM OPENROWSET(BULK 'd:\full\path\to\file\filename.txt', SINGLE_NCLOB) AS...

    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: Working with stored text file in TSQL

    Gotta' admit, I prefer working in SQL/TSQL, so even for (moderately) large text files I'll often just do an:

    OPENROWSET(BULK '<path_and_file_name>', SINGLE_CLOB) --or NCLOB, if req'd

    to load the whole file at...

    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: Tempdb is full for Large Table Joins

    Grant Fritchey (3/25/2014)


    ScottPletcher (3/25/2014)


    Grant Fritchey (3/25/2014)


    I can't see the query since it exceeds the size of what's stored in the plan, so suggestions from the plan alone are going to...

    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: Tempdb is full for Large Table Joins

    Hard to provide more details without the rest of the query and with no index info on the tables.

    Edit: Looks like a covering index is needed on SubOrderTrans at least,...

    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: Tempdb is full for Large Table Joins

    Grant Fritchey (3/25/2014)


    I can't see the query since it exceeds the size of what's stored in the plan, so suggestions from the plan alone are going to be a bit...

    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 optimise this query

    Best guess with what's known so far:

    Create an index on "order":

    key = ( claim_id ); include = ( order_id, created_dtm )

    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: Moving MDF and LDF files

    GilaMonster (3/15/2014)


    ALTER DATABASE with the WITH MOVE clause

    Take the database offline

    Copy the files to their new location

    Bring the DB online.

    Test in a dev/test environment first.

    I'm not aware of "ALTER DATABASE...

    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: Efficient way to get the lowest unused value of a nvarchar field being used as a primary key

    My best quick guess is that a StartTime of NULL indicates an unused entry. Even if not, the code below may give you some ideas for the correct column(s)...

    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: EXCEL-SQLServer - Is is possible to force isolation level read uncommited for specific logins ?

    You could set specific byte(s) in CONTEXT_INFO() in the trigger, then have other relevant SQL code check those byte(s) and set the isolation level appropriately based on the value of...

    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: Custom sort order within each group of the result set

    No, I'm sorry, I didn't realize you literally wanted the sort order in the result.

    We will have to use ROW_NUMBER() for that, but I don't think we have to use...

    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,196 through 6,210 (of 7,619 total)