Forum Replies Created

Viewing 15 posts - 5,161 through 5,175 (of 7,613 total)

  • RE: Insert DATE --Confused with convert

    Orlando Colamatteo (4/22/2015)


    ScottPletcher (4/22/2015)


    Orlando Colamatteo (4/22/2015)


    ScottPletcher (4/22/2015)


    Orlando Colamatteo (4/22/2015)


    I'll second the point: definitely store your dates and times in a column of type DATETIME. If you make that a non-negotiable...

    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 query help

    CELKO (4/22/2015)


    Why are you changing obvious integer data types to character data types?

    Please read any book on basic data modelling and look at the chapters on scales and measurements....

    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: Insert DATE --Confused with convert

    Orlando Colamatteo (4/22/2015)


    ScottPletcher (4/22/2015)


    Orlando Colamatteo (4/22/2015)


    I'll second the point: definitely store your dates and times in a column of type DATETIME. If you make that a non-negotiable starting point 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: What is the Formula to estimate\forecast space for non-clustered index on a table

    Eric M Russell (4/22/2015)


    ScottPletcher (4/22/2015)


    Eric M Russell (4/22/2015)


    ScottPletcher (4/22/2015)


    With an existing table, you already know what the length of the columns will be, whether varchar or not. The formula...

    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: What is the Formula to estimate\forecast space for non-clustered index on a table

    Eric M Russell (4/22/2015)


    ScottPletcher (4/22/2015)


    With an existing table, you already know what the length of the columns will be, whether varchar or not. The formula provides you with 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: What is the Formula to estimate\forecast space for non-clustered index on a table

    With an existing table, you already know what the length of the columns will be, whether varchar or not. The formula provides you with the additional overhead SQL requires...

    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 query help

    It has to be the pointy-haired boss types that hire Celko. No one who actually knew any practical implementations would ever change obvious numeric values to character. There'd...

    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 help to display row as 2 days ago, 1 hours 34 Minutes ago, 11 minutes ago

    SELECT

    crtdte,

    ISNULL(CAST(NULLIF(minutes_ago / 1440, 0) AS varchar(5)) + ' days, ', '') +

    ISNULL(CAST(NULLIF(minutes_ago % 1440 / 60, 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: What is the Formula to estimate\forecast space for non-clustered index on a table

    Books Online has very specific formulas for how to do that, under:

    "Estimating the Size of a Nonclustered 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: Performance optimization in stored procedure to perform sorting and filtering

    This should definitely be faster. I've tested it for ASC sort but not for DESC -- I believe I've coded it to correctly handle DESC sort, I just haven't...

    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: Insert DATE --Confused with convert

    Orlando Colamatteo (4/22/2015)


    I'll second the point: definitely store your dates and times in a column of type DATETIME. If you make that a non-negotiable starting point the rest of this...

    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 Delete All Records Then Copy All From Another Table

    As an aside, if possible, TRUNCATE the table rather than use DELETE to reduce logging.

    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: Use cursor to run dynamic SQL to find special characters used in database

    Mark Finnie (4/21/2015)


    Thank you Scott. I had to replace TableName with TblName becuase some audit tables had columns with that name, resulting in ambiguous column name errors. The query then...

    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: Update statement performance

    Code below could perform better, esp. if table2 and table3 don't have an index that directly supports the lookup/comparison being done.

    Edit: And performance could be worse with this 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: Creating Rows Between Dates In A Single SQL Statement

    Another perfect situation for a tally table. You can create an in-line table using CROSS JOINs or create a physical tally table and use that. Unfortunately I can't...

    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,161 through 5,175 (of 7,613 total)