Forum Replies Created

Viewing 15 posts - 2,446 through 2,460 (of 5,393 total)

  • RE: How to implement a constraint over multiple rows

    Lowell (10/13/2011)


    you guys completely forgot that you can use a check constraint that uses a user defined function...

    No, I'm not forgetting, I'm deliberately avoiding that. 😛

    From a performance standpoint, it...

    -- Gianluca Sartori

  • RE: Covert style 120 vs 102

    vick12 (10/13/2011)


    what is teh difference between 108 and 109.

    Style 109 is 'mon dd yyyy hh:mi:ss:mmmAM', for instance 'Oct 13 2011 2:57:12:350PM'.

    AS you can see, this format cannot be sorted...

    -- Gianluca Sartori

  • RE: How to implement a constraint over multiple rows

    Darn! I guess you're out of luck.

    I tried in many ways, but I think that this particular requirement can't be implemented with an indexed view.

    Some restrictions apply, and one of...

    -- Gianluca Sartori

  • RE: Covert style 120 vs 102

    Lynn Pettis (10/13/2011)


    vick12 (10/12/2011)


    SELECT starttime, convert(varchar(20), starttime,102)+convert(varchar(20), starttime,108) FROM testdate ORDER BY convert(varchar(20), starttime,102)+convert(varchar(20), starttime,108)

    I don't see a distinct in the original query.

    Sorting on starttime will give the same results...

    -- Gianluca Sartori

  • RE: Usign MAX(DATE) function to select only the latest results

    Richard Warr (10/13/2011)


    Alternatively, you could use ROW_NUMBER to accomplish this:

    SELECT VulnID, Host, SCANCOMPLETETIME FROM (

    SELECT VulnID, Host, SCANCOMPLETETIME,

    ROW_NUMBER() OVER (PARTITION BY Host, VulnID ORDER BY SCANCOMPLETETIME DESC) rw FROM...

    -- Gianluca Sartori

  • RE: How to revoke SysAdmin preveleges for multiple accounts based on selecting the accounts

    Prepare a list of disabled users and add it to this code.

    USE master;

    GO

    DECLARE @DisabledUsers TABLE (

    LoginName nvarchar(128)

    )

    INSERT INTO @DisabledUsers VALUES ('Tom')

    INSERT INTO @DisabledUsers VALUES ('[MyDomain\Harry]')

    INSERT...

    -- Gianluca Sartori

  • RE: How to implement a constraint over multiple rows

    You can use an INDEXED VIEW and a UNIQUE constraint.

    See my blog here[/url].

    -- Gianluca Sartori

  • RE: Covert style 120 vs 102

    Phil Parkin (10/13/2011)


    I suspect (just a wild guess) that the query contains DISTINCT in the select list and, since the OP is selecting the converted date, can only ORDER BY...

    -- Gianluca Sartori

  • RE: Row concatenation with FOR XML, but with multiple columns?

    I'm afraid I ended up overcomplicating the original problem.

    Anyway, here's my solution:

    -- SETUP: Create master table (sentences)

    DECLARE @ThisTable TABLE (

    id int

    )

    -- Create detail table (sentences broken in rows, Latin, English,...

    -- Gianluca Sartori

  • RE: Covert style 120 vs 102

    Lynn Pettis (10/12/2011)


    What is wrong with just using ORDER BY starttime?

    I suspect (just a wild guess) that the query contains DISTINCT in the select list and, since the OP is...

    -- Gianluca Sartori

  • RE: Usign MAX(DATE) function to select only the latest results

    You just need to reference the main query in the subquery. Something like this:

    DECLARE @VULNS_VIEW TABLE (

    VulnID int,

    HOST varchar(10),

    SCANCOMPLETETIME datetime

    )

    INSERT INTO @VULNS_VIEW

    ...

    -- Gianluca Sartori

  • RE: Cannot Update SQL Server 2000 Agent jobs using SSMS 2008 R2

    Is your SSMS patched to the latest service pack?

    I've seen some bugs in the RTM version regarding SQL Agent Jobs.

    -- Gianluca Sartori

  • RE: Formatting a report in 2005

    You're welcome, glad I could help.

    -- Gianluca Sartori

  • RE: Are the posted questions getting worse?

    Lynn Pettis (10/12/2011)


    To proudly go where few have gone! Just how many people have gone into space? What an honor it would be to be a part of...

    -- Gianluca Sartori

  • RE: Are the posted questions getting worse?

    jcrawf02 (10/12/2011)


    While that's funny, I can't imagine why anyone would ever want to do that. This is the coolest thing I've ever heard.

    I'm scared to death whenever I fly with...

    -- Gianluca Sartori

Viewing 15 posts - 2,446 through 2,460 (of 5,393 total)