Forum Replies Created

Viewing 15 posts - 2,041 through 2,055 (of 7,613 total)

  • Reply To: column has a single quotation causing error

    Double any existing single quotes in the data:

    ... + REPLACE(data, '''', '''''') /*make every ' in the data become '' */ + ...

    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".

  • Reply To: Create Unique combination as Key out of N columns

    Jeff Moden wrote:

    ScottPletcher wrote:

    I've never seen an UPDATE pattern that bizarre in over 30 years in IT.  From 6 to 16,000,000?  I can't even imagine the business case that would cause...

    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".

  • Reply To: Create Unique combination as Key out of N columns

    Jeff Moden wrote:

    ScottPletcher wrote:

    In SQL 2016, it's rarely a waste of disk space.  Specifying ROW compression is standard procedure for all tables unless there's a specific reason not to.

    "Standard Procedure...

    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".

  • Reply To: Create Unique combination as Key out of N columns

    Jeff Moden wrote:

    ScottPletcher wrote:

    I still prefer my single int as a metakey method.  16 bytes is a lot of overhead for a linking key.  I don't see an advantage to it. ...

    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".

  • Reply To: Create Unique combination as Key out of N columns

    I still prefer my single int as a metakey method.  16 bytes is a lot of overhead for a linking key.  I don't see an advantage to it.  And 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".

  • Reply To: Create Unique combination as Key out of N columns

    Jeff Moden wrote:

    ScottPletcher wrote:

    And what if one or more of the column values change?

    Like I said in the comments in the code...

         -- 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".

  • Reply To: Create Unique combination as Key out of N columns

    And what if one or more of the column values change?

    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".

  • Reply To: MSSQL 2019 - SQL Server Agent - Jobs account

    Only someone with full sysadmin authority can change a job's owner.

    Typically after the job is fully debugged and running normally, sysadmin changes the job owner to a standard job-running account.

    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".

  • Reply To: SQL removing characters

    I added an RTRIM to get rid of any trailing space(s).  Naturally if you don't want to do that, delete the RTRIM from the code.

    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".

  • Reply To: Access to SQL expression

     

    SELECT
    string_to_parse,
    CASE WHEN first_dash = 0 THEN ''
    WHEN first_dash = last_dash...

    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".

  • Reply To: TSQL Script: Min, Max function

    This looks to me like a Gaps and Islands query.  Itzik Ben-Gan has posted numerous articles and written in books how best to solve those types of queries.

    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".

  • Reply To: Create Unique combination as Key out of N columns

    Jeff Moden wrote:

    ScottPletcher wrote:

    Jeff Moden wrote:

    You have some values that have leading zeros.  Must the leading zeros be preserved?  If so, then not all of the columns are actually INTs as 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".

  • Reply To: Create Unique combination as Key out of N columns

    nvm, OP obviously not interested at all in this approach.

    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".

  • Reply To: Build hierarchy multi-column table on data in 1 column based on string length

    Jeff Moden wrote:

    FL0XN0X wrote:

    I was too enthousiastic. What I did was I only took the 7 character long records (WHERE LEN(column1)=7) and then applied the LEFT functions as indicatde above. But,...

    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".

  • Reply To: Create Unique combination as Key out of N columns

    Jeff Moden wrote:

    You have some values that have leading zeros.  Must the leading zeros be preserved?  If so, then not all of the columns are actually INTs as you said.  Let...

    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 - 2,041 through 2,055 (of 7,613 total)