Forum Replies Created

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

  • RE: Lazy Table Spool triggered by a Clustered Index Seek -- ISNULL() in the WHERE clause the trigger?

    If you typically query the Document table by PersonId, change the clustered key on the Document table to be PersonId instead and you should get great response time for individuals...

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

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

  • RE: SQL Audit - DML action type for database role

    Try:

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

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

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

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

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

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

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

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

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

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

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

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

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