Forum Replies Created

Viewing 15 posts - 7,171 through 7,185 (of 7,613 total)

  • RE: GROUP BY conundrum

    And for general performance reasons, get rid of the functions on the date/datetime column:

    SELECT p.product,

    SUM(CASE WHEN j.holiday = 0 THEN j.qty_delivered END) AS...

    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 there a way to tell if a box is really a VM or physical server?

    You could try:

    SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS')

    If that doesn't work, there are SERVERPROPERTY parameters that aren't documented: you might try poking around for some of those and see if any of them help...

    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 Audit - DML action type for database role

    Try:

    ADD (SELECT ON OBJECT::[dbo].[SecDetail] BY [dbo])

    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: Behavior of "NOT IN"

    S_Kumar_S (9/24/2012)

    I logically expect NULL records to be returned here, but they are not. ... Is there some setting which impacts this behavior?

    Yes there is a setting, but you should...

    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 to concatenate two columns and update in new column

    Jeff Moden (9/24/2012)

    It would take a little more space but I recommend adding the PERSISTED hint.

    For me, it depends, mostly on how and/or how often the full_name was used.

    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 to concatenate two columns and update in new column

    Agreed.

    For example:

    ALTER TABLE dbo.tablename

    DROP COLUMN Full_Name;

    ALTER TABLE dbo.tablename

    ADD Full_Name AS CAST(ISNULL(F_Name + ' ', '') + ISNULL(Lname, '') AS varchar(100))

    -- change 100 to whatever max length you want for...

    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 Needed

    Jeff Moden (9/20/2012)


    SomewhereSomehow (9/20/2012)


    That a person is in wikipedia means that he is notorious enough that someone thought to write of him.

    It is also possible that person wrote about themselves...

    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 Needed

    SomewhereSomehow (9/20/2012)


    Evil Kraig F (9/20/2012)


    Perhaps, I've been accused of optimism before... rarely, but it's happened. I'm sorry to hear your political system is falling apart however.

    Actually it is...

    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 Needed

    GSquared (9/20/2012)


    SomewhereSomehow (9/20/2012)


    Nope. Not going to taint you with my personal opinions regard Mr. Celko. Too bad he is a co-author with Itzik on a book as 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: ms standards doc?

    sqlguy-736318 (9/19/2012)


    I think it's unfortunate that MS doesn't provide an automated tool to review a SS database for standards compliance. The nice thing about FXCop is that it's somewhat...

    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: ms standards doc?

    Lynn Pettis (9/19/2012)


    Also, don't name your procedures with "sp_" as you may run afoul of a Microsoft system stored procedure of the same name.

    Quite true! In fact, don't start...

    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: ms standards doc?

    I think MS had that at one point but they dropped it.

    In general, carefully determine rules among yourselves and

    most of all, consistently follow them.

    FWIW, here are my...

    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: Count number of rown in transaction without adding to a parameter?

    If you want/need EXEC() (vs sp_executesql), then you can use a temp table to return the row total:

    DECLARE @sql VARCHAR(2000)

    CREATE TABLE #result ( total_rows int )

    SET @sql = '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: Count number of rown in transaction without adding to a parameter?

    SQLKnowItAll (9/19/2012)


    Here's some sample code:

    CREATE TABLE #test(id int identity (1,1), filler VARCHAR(1))

    GO

    INSERT INTO #test(filler)

    SELECT 'a'

    GO 5

    DECLARE @sql VARCHAR(150)

    SET @sql = 'BEGIN TRAN SELECT * FROM #test SELECT * 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: Count number of rown in transaction without adding to a parameter?

    Sean Lange (9/19/2012)


    SQLKnowItAll (9/19/2012)


    Here's some sample code:

    CREATE TABLE #test(id int identity (1,1), filler VARCHAR(1))

    GO

    INSERT INTO #test(filler)

    SELECT 'a'

    GO 5

    DECLARE @sql VARCHAR(150)

    SET @sql = 'BEGIN TRAN SELECT * FROM #test 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".

Viewing 15 posts - 7,171 through 7,185 (of 7,613 total)