Forum Replies Created

Viewing 15 posts - 5,251 through 5,265 (of 7,619 total)

  • RE: Index alignment in partitioning

    Matthew Darwin (4/1/2015)


    Yes, that's the clustering choice I would have made; in fact I would have made that the pk. However, this is already in existence and has been...

    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: Deadlock involving query against sys.tables

    You can try to get SQL to make the ALTER the task that SQL kills if a deadlock occurs, but I've found it's not 100% effective.

    SET DEADLOCK_PRIORITY -8

    ALTER INDEX ALL...

    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: Index alignment in partitioning

    Cluster the original table on ( CreatedDate, SmsId ), in that order, not vice-versa.

    Once you get the best clustering key, you're likely not to need partitioning yet. And, 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: T-SQL Help...probably pretty simple but I'm tired :)

    I've seen it cause errors, although it's somewhat obscure, a combination of things, including linked servers, IIRC. Perhaps it's been fixed, but I don't intend to risk job failures...

    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: T-SQL Help...probably pretty simple but I'm tired :)

    CELKO (3/31/2015)


    use lowercase only for data type names in SQL Server

    .

    No. The human eye reads certain words as a single unit called a bouma. The keywords in programming...

    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: T-SQL Help...probably pretty simple but I'm tired :)

    A JOIN is preferred over the older-style WHERE clause, although with an INNER JOIN they should function the same either way:

    INSERT INTO myTable

    (ID,someData,someData2)

    SELECT

    ...

    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 convert below mentioned stored procedure into user defined function..Please revert me back ASAP..Itz urgent

    It's some version of DB2 / UDB.

    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: T-SQL Help...probably pretty simple but I'm tired :)

    As a side note, but still critical, let me warn everyone to use lowercase only for data type names in SQL Server. That is, "int" not "INT", "datetime" not...

    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: Display dates between two dates

    Using an in-line tally table would be more efficient:

    /* add in-line tally table (CROSS JOINs of 10 x 10 = 100; 100 x 100 = 10K) here,

    ...

    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: How to quickly update/insert 3M records in a large table?

    George Wei (3/28/2015)


    Dear all,

    Our system runs a SQL Server 2012 DB, it has a table (table_a) which has over 10M records. Our system have to receive data file from previous...

    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 delete historical data

    You could consider clustering the table on the datetime involved. Then you can delete old data with minimal effect on current rows, particularly by reducing the number of non-clustered...

    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: Adding Minutes(varchar) to a datetime field

    I've also seen vast numbers of errors created by explicit conversions. If you're forced to deal with temporal data stored as char/varchar, then store it in a universal format...

    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 scenario question

    Sorry:

    WHERE (@IsProcessed IS NULL OR @IsProcessed = <table_column>)

    Edit: general pattern, you may need to change it slightly.

    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 scenario question

    WHERE IsProcessed IS NULL

    If you want to check for new rows to process while existing rows are being processed, look into the "READPAST" hint.

    If you just need to quickly find...

    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: Adding Minutes(varchar) to a datetime field

    Eirikur Eiriksson (3/27/2015)


    ScottPletcher (3/27/2015)


    Just add them and SQL will implicitly convert the varchar to a datetime anyway:

    SELECT datetime_column + time_varchar AS new_datetime, ...

    FROM ...

    Until the locale driven implicit conversion starts...

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