Forum Replies Created

Viewing 15 posts - 3,826 through 3,840 (of 7,619 total)

  • RE: Querying Postcodes gracefully

    Thom A - Wednesday, May 3, 2017 4:39 PM

    ScottPletcher - Wednesday, May 3, 2017 4:05 PM

    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: Querying Postcodes gracefully

    Change your table to never store the space in the post code column (you can use a trigger to do this, at least until you change the app; you can...

    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: Find highest number in a column of strings

    If the format is always xxx###, then:
    SELECT MAX(RIGHT(column, 3))

    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: Federal Holiday Function

    Here's another alternative.  Btw, I corrected two holiday descriptions, for Jan and Feb.  It's not "President's Day", it's "[George] Washington's Birthday"; I wish the media would stop repeating the wrong...

    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 for status

    I think something along these lines:


    SELECT user,
      CASE WHEN confirmed_count = user_count THEN 'Confirmed'
       WHEN not_confirmed_count > 0 THEN 'Not Confirmed'
       WHEN confirmed_with_caveat_count >...

    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: database design

    Do a data design first -- that is, a logical design -- before you do a database design (a physical design).  Otherwise you almost always end up with a poor...

    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: Function return values

    Interesting q.  I don't believe that info is stored in any system table, I think SQL generates it (only) when the function executes.

    To get the column names, 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: Can't restore differentials from backupset

    It looks like the FULL backup is from after the DIFF was taken.  You'd need to use the full from before the diff.

    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 query and email


    CREATE TRIGGER tr_DWH_HRxsins
    ON dbo.DWH_HRxsDEL
    AFTER INSERT
    AS
    SET NOCOUNT ON;
    DECLARE @record varchar(1000)
    SELECT @record = STUFF((
      SELECT '. Record RXNO ' + CAST(i.id...

    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 2012 declare variables issue

    Maybe something like this (?):


    CREATE TABLE #templates_update (
      stringtemplate varchar(max) NOT NULL,
      milestone varchar(10) NOT NULL,
      language varchar(10) NOT NULL
      )

    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: Login is a dbowner of the database but not shown up as a user of the database

    Its owner name is likely 'dbo'.  The actual owner of the db has the user name 'dbo', even though the login name is different.  Remember, SQL doesn't require the login...

    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: Salesforce data and missing foreign keys

    If FK constraints have been defined, you can use views:
    sys.foreign_keys and
    sys.foreign_key_columns
    to check for invalid / missing FK values.  If you're not worried about checking NULL values, 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: Extract only the filename from a file path

    I like to code to handle the case where there's no '\' in the data, to avoid the dreaded "Invalid length passed to RIGHT function."


    DECLARE...

    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: Table size and indexes

    Full DDL for the table would really help.  But for now, try these indexes and then re-examine the stats in a week or two.  Index tuning is definitely an iterative...

    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: Table size and indexes

    Sorry; in this statement:
    ...
    SET @table_name_pattern = '%' --<<--put your preferred table name / name LIKE pattern 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".

Viewing 15 posts - 3,826 through 3,840 (of 7,619 total)