Forum Replies Created

Viewing 15 posts - 6,391 through 6,405 (of 7,619 total)

  • RE: Best way to move Several Million Record query results to a table?

    4 tables of between 1M and 2M rows shouldn't take much time to run, except on a very limited server.

    There must be something in the query that is causing some...

    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: data search solution

    Some points to consider:

    Be sure to make the search value a character string, viz:

    SET @MySearchCriteria = '''3496'''

    "Max_length" is bytes, which works fine for (n)(var)char, but not so much for int,...

    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: Refresh Default Table Value Upon Update

    A trigger is the best way to handle 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: One sa password to rule them all?

    In a D/R situation, it might be a royal pita to have only AD accounts to have access to the instance.

    I'd rather be able, in a genuine emergency, to bring...

    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: DATEPART WITH YEAR AND MONTH

    WHERE

    Docket_Date >= DATEADD(MONTH, DATEDIFF(MONTH, 0, @date1), 0) AND

    Docket_Date < DATEADD(MONTH, DATEDIFF(MONTH, 0, @date1) + 1, 0)

    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: One sa password to rule them all?

    I would never allow the sa password to be the same on more than one instance. The sa account is to be used only in an emergency anyway (such...

    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: view points to linked server tables

    No, it's not a good idea. SQL will typically not be able to generate as good a plan for remote tables as it does for local ones.

    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: round down

    You can get the result you need: the specific method depends on specifically what you need to do. If you can provide sample values and the desired results, we...

    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: Time difference

    For anything less than 24 hours, you can do this:

    SELECT

    CONVERT(varchar(8), DATEADD(SECOND, DATEDIFF(SECOND, segstart, segstop), 0), 8)

    FROM (

    SELECT CAST('20130906 09:28:00' AS datetime) 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: Help with Output in a Merge Statement

    Just list the column names that are being inserted into the new table; you don't have to supply all columns. For example, see below; naturally your specific column names...

    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: SELECT???? Query idea???

    SELECT *

    FROM dbo.tablename

    WHERE Customer IN (

    SELECT Customer

    FROM dbo.tablename

    GROUP BY Customer

    HAVING COUNT(DISTINCT Contract) > 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".

  • RE: Updating a Temp Table column with data from another column in same Temp Table (data from previous month)

    UPDATE CurrMonth

    SET [PrevPerc] = PrevMonth.[CurrPerc]

    FROM #Month CurrMonth

    INNER JOIN #Month PrevMonth ON

    PrevMonth.[DEPARTMENT] = CurrMonth.DEPARTMENT AND

    PrevMonth.[YEAR] = CurrMonth.[YEAR] - CASE WHEN CurrMonth.[MONTH] =...

    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 Strings

    I wouldn't use PARSENAME here because of potential side effects, for example, periods (.) in the data or brackets ([]) around a piece of data. The code below should...

    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: Change Data Capture as a long-term change-tracking solution

    Yeah, it wasn't intended to be used that way, so my guess is it wouldn't work all that well for that. Even performance could become a real issue 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: Query to Return each field that is Not Null

    Something like this may do it for you:

    SELECT

    tn.ID, tn.Status, tn.Description, tn.[Project Number],

    ColNames.ColName

    FROM dbo.tablename tn

    INNER JOIN (

    SELECT 'FreeText01'...

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