Forum Replies Created

Viewing 15 posts - 76 through 90 (of 371 total)

  • RE: Sequences I

    I chose "1" as the default start value because I thought it would have the same behaviour of the IDENTITY property which defaults to "start with 1, increment 1". Seems...

  • RE: Grouping by ten days period

    dwain.c (4/18/2012)


    Here's a solution that will create the 10 day groups for only the groups where you have data.

    DECLARE @startdate DATETIME

    SELECT @startdate = DATEADD(year, DATEDIFF(year, 0, '2010-05-31'), 0)

    ;WITH Dates AS...

  • RE: Foreign key

    Thanks for the question.

    I think what the author meant was that a FK cannot reference an external database and the explanation says there is a way to SIMULATE a FK...

  • RE: DMV Problem - dm_exec_query_stats

    ggjjbb1983 (4/5/2012)


    Is there any reason why a sample scan would be performed instead of a full scan?

    I may be guessing it wrong here but maybe it's because a statistics update...

  • RE: VIEWS 5

    After reading through the excellent debate around views last week, I was sure what to answer even though there were few answers to choose this time. Thank you for making...

  • RE: View to show calculated column

    Also Lutz' solution is probably easier to understand and maitain with that OUTER APPLY. ๐Ÿ˜‰

  • RE: View to show calculated column

    How about something like this:

    SELECT X.Description,

    X.DueDate,

    X.Colour

    FROM (SELECT ROW_NUMBER() OVER (PARTITION BY T.Description ORDER BY...

  • RE: VIEWS 4

    @alex: indeed. In my last job, views were used everywhere but they were not schema bound. I talked them into using that option whenever new objects were created and we...

  • RE: SP_Who_3

    Sorry, misread the error messages.

  • RE: VIEWS 4

    L' Eomot Inversรฉ (3/29/2012)


    the solution is (a) make views schema bound and (b) test the apps properly if you change the schema. Doing either will prevent the particular problem...

  • RE: How to use rank over this query

    Thanks a lot for the detailed explanation!

    I got confused thinking that ORDER BY 0 or 1 was about the column order like in:

    SELECT TOP(10) name, type FROM sys.objects ORDER BY...

  • RE: SP_Who_3

    If I get this right and you want to run this without creating the procedure, you'll need to declare the variables that are passed as parameters to the procedure.

    DECLARE

    @run_mode NVARCHAR(12)...

  • RE: How to use rank over this query

    Mark-101232 (3/30/2012)


    with cte as (

    select stageid,stagestatustypeid, applictaionid,

    row_number() over(partition by applictaionid order by case when stagestatustypeid<>1 then 0 else 1 end,stageid desc) as rn

    from...

  • RE: Find Customers Who Bought "A" and "B" But Not "C" (SQL Spackle)

    Jeff Moden (3/29/2012)


    Thanks for the feedback, Andre. I just have to get better at beating the general public at my own game. ๐Ÿ˜›

    I love this forum and this community....

  • RE: Find Customers Who Bought "A" and "B" But Not "C" (SQL Spackle)

    Hi, Jeff.

    Indeed. I was at work and couldn't test it properly.

    I should've noticed that the IN clause may bring results from either A OR B. ๐Ÿ™‚

    That's an excellent article by...

Viewing 15 posts - 76 through 90 (of 371 total)