Forum Replies Created

Viewing 15 posts - 5,656 through 5,670 (of 7,619 total)

  • RE: Finding 5 most recent records for each customer with abnormal order amounts

    FWIW, sure potentially sounds to me like homework or the equivalent.

    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: Create a view in sql with a column that counts

    I don't know exactly how you want to order the results, but something like this should do what you want:

    SELECT

    ol.OrdNo, ol.ProdNo, ol.Descr,ol.DPrice, pr.PictNo, pr.NoteNm as DescriptLong,

    (ROW_NUMBER() OVER(ORDER BY ol.OrdNo,...

    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 calculate two new aliases columns into one?

    You can use CROSS APPLY to assign alias names to expressions:

    select distinct top 100 filedate, transaction_date, duedate,

    event_instance, event_name, eventstatus, age,

    DaysAged,

    coalesce (DaysAged, new, 0) as aged

    from...

    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: Best way to validate telephone number

    Best is to always strip non-numeric chars before storing the value. If you have to, store both the original, edited version and a stripped version, or, better yet, a...

    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 maintain read acces to a login after database is refreshed?

    Does that user/login also exist in prod? If so, the SIDs of the prod login and the nonprod login are different. If you want the user to work...

    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: View column that checks if table's int column is null, enters a boolean value in the view column instead of the int value

    GilaMonster (10/29/2014)


    ISNULL (IntegerColumnName, ReplacementValue)

    The data type returned will be the 'larger' of INT and whatever the replacement value is.

    btw, SQL doesn't have booleans. It has the bit data type which...

    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 table with several 'date' type columns

    I think this is the general structure you need:

    SELECT p.*, d_outer.date

    FROM Project p

    INNER JOIN Date d ON

    p.ProjectID = d.ProjectID

    CROSS APPLY (

    VALUES(d.Date1),(d.Date2),(D.Date3) /*,...,D.Date20*/

    )...

    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: Calculating working hours between 2 dates.

    Here's my take on this. I listed the break and lunch time as separate columns but would change the final code to instead subtract from the working minutes in...

    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 query to find Parallelism query history?

    As a first try, look at that instance, "Reports", "Standard Reports", "Total CPU Time" and "Average CPU Time".

    On rebooting, it depends. If you have a lot of non-SQL stuff...

    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: Is partitioning working?

    Not really any easy way to get on-going accurate data at the partition level.

    View sys.dm_db_index_operational_stats might help, particularly if the index/partition is very busy and thus (almost) never leaves 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: Database Design Follies: NULL vs. NOT NULL

    Robert Mark (10/30/2014)


    I don't know how anyone using an application and seeing a NULL value on the screen would equate the NULL value to anything other than a zero. ...

    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 Follies: NULL vs. NOT NULL

    Starwatcher (10/30/2014)


    kenambrose (10/30/2014)


    very simple solution to all the nonsense.

    MAKE ALL COLUMNS NOT NULLABLE.

    If you can't figure out how to design a schema where that works for your business requirements,...

    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 Follies: NULL vs. NOT NULL

    ZZartin (10/30/2014)


    Robert Mark (10/30/2014)


    I don't know how anyone using an application and seeing a NULL value on the screen would equate the NULL value to anything other than a zero....

    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: trigger is not firing on a table

    It sounds like you need something along these lines:

    ALTER TRIGGER [dbo].[trU]

    ON [dbo].[tblEvent]

    AFTER INSERT

    AS

    SET NOCOUNT ON;

    UPDATE c

    SET avbl= CASE

    WHEN i.[Desc]...

    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: Advance script help. Second Saturday following month?

    stevemr68 (10/28/2014)


    ScottPletcher - This is great but it's showing the 3rd Saturday of the weekend not the second.

    D'OH, quite right, sorry. "13" days should be added, not 19. ...

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