Forum Replies Created

Viewing 15 posts - 5,311 through 5,325 (of 7,619 total)

  • RE: Data types and row size question

    Let me point out that using a char-based column for a date is a very bad idea. Not only does it take more space but it will get garbage...

    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: Second Friday of every month

    Here's the code with the tally table built in as a derived table rather than a CTE.

    Note that we need an actual date computation to compute the first desired Friday...

    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: Second Friday of every month

    First, let's note that we need an actual date computation only for the first Friday. For the subsequent Fridays, we can simply add 7 more days.

    Note: I...

    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: Separate Identity key and CI

    TryingToLearn (3/12/2015)

    It has one column( identity column) as the PK and...

    It has another column is used as CI

    Is there ever a benefit to this approach?

    Yes; indeed, that is the...

    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: Issue of retrieving same identity column value by multiple users

    Edit: Bolded mods to original code.

    BEGIN TRANSACTION

    DECLARE @DEPTNBR BIGINT

    SELECT TOP (1) @DEPTNBR = DEPTNBR

    FROM DEPARTMENT_DETAILS WITH (UPDLOCK,READPAST)

    WHERE STATUS = 1

    UPDATE DEPARTMENT_DETAILS

    SET STATUS = 0

    WHERE DEPTNBR =...

    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: Changing Order by

    CASE @Sort_Sel

    WHEN 'Resource' THEN R.RESCODE

    ELSE RIGHT(REPLICATE('0', 10) + CAST(D3.DATEID AS varchar(10)), 10)

    END ASC

    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: Size of Data Roadblocks

    xsevensinzx (3/10/2015)

    GilaMonster (3/10/2015)


    Partitioning is not done for performance reasons. It's for data management, fast loads and fast deletes. It won't necessarily improve performance, it may, in fact, reduce performance. If...

    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: Convert Varchar to Time

    SELECT *

    FROM ( --[SMF_DATA].[dbo].[System_Management_Facility]

    SELECT CPUTM = '335:55:20.97',

    CPUZIPTM = '0:00:01.96'

    ) AS test_data

    WHERE

    (LEFT(CPUTM, CHARINDEX(':', CPUTM) -...

    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: Size of Data Roadblocks

    If the table is already clustered on time (hooray!), then reading a week's worth of data shouldn't take that long.

    We need to review two things (at least).

    First, the query code...

    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: Converting the datatype of a computed column

    Would need to see the specific cast and data values to be sure, but most likely the whole decimal places weren't large enough to hold the character value.

    For example, you...

    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: Joining on a table with a Unique Clustered Index

    If you want an index to be unique, you must explicitly specify that in SQL. You should also always explicitly specify the proper fillfactor and filegroup (even if it'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: replace() remove the last character of some values

    SQL_NuB (3/4/2015)


    Jeff Moden (3/4/2015)


    What's wrong with just doing a replacement?

    UPDATE tgt

    SET Family = REPLACE(Family,'--','')

    FROM dbo.yourtable

    WHERE Family LIKE '%--%'

    ;

    there are other...

    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: Dynamic Return type in a function

    In order to accept and return differing data types, you'd have to use sql_variant, which will affect how easily you can use the value returned by the function:

    CREATE FUNCTION [dbo].[fnchkNull]...

    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: Job to run more than one job in order

    Removed, duplicate post.

    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: Job to run more than one job in order

    Removed, duplicate.

    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 - 5,311 through 5,325 (of 7,619 total)