Forum Replies Created

Viewing 15 posts - 16 through 30 (of 52 total)

  • RE: A question on JOIN

    Sean Lange (5/29/2015)


    sarath.tata (5/29/2015)


    Sean Lange (5/29/2015)


    Your question is not at all clear. What would be helpful is if you could post ddl and sample data in addition to the desired...

  • RE: A question on JOIN

    Sean Lange (5/29/2015)


    Your question is not at all clear. What would be helpful is if you could post ddl and sample data in addition to the desired output. I think...

  • RE: Generating Dates at Runtime

    Just in case somebody wants

    DECLARE @StartDate DATE

    DECLARE @EndDate DATE

    DECLARE @RotationDays INT

    SET @StartDate = '01/01/2015'

    SET @EndDate = '12/31/2015'

    SET @RotationDays = 4

    ;WITH result AS

    (

    SELECT DATEADD(DAY, (ROW_NUMBER() OVER...

  • RE: Generating Dates at Runtime

    Eric M Russell (5/29/2015)


    The following will easily give you what you want, without resorting to a loop. It basically just applies row_number() across a resultset to get a sequential set...

  • RE: Generating Dates at Runtime

    I have found a solution. Not so sure, if it is the best solution!!

    DECLARE @StartDate DATE = '01/01/2015'

    , @EndDate DATE = '01/08/2015'

    SET @StartDate = DATEADD(DAY, -7, @StartDate)

    ;WITH...

  • RE: Row Lock Question

    Is this solution efficient?

    DECLARE @NextNumber BIGINT

    BEGIN TRAN

    SELECT @NextNumber = NextNumber FROM tblOnboardingSequence WITH (HOLDLOCK, ROWLOCK) WHERE Name = 'TPO'

    UPDATE tblOnboardingSequence SET NextNumber = @NextNumber + 1 WHERE Name = 'TPO'

    COMMIT...

  • RE: Table Join issue

    I don't understand the reason but when I removed alias in column name it worked!!

    SELECT DutyRosterPeriodID, StartDate, EndDate, CASE WHEN HolidayDate IS NULL THEN 0 ELSE 1 END...

  • RE: Storing Dynamic Query Output in Temp Table

    I can't use global temp variables as it differs per request.

    if my query is in @sql, so far I could find the way to pre-create temp...

  • RE: Table Join issue

    I could n't give complete executable query as it is part of a dynamic query which requires plenty of tables.

    This is my pivot. Do you think I missed some...

  • RE: Table Join issue

    It is strange!! I had this query as part of another Pivot query. The error might be because of that. I need to look into this now. ...

  • RE: Format Phone Number function

    Nice work

    Steven Willis (12/7/2010)


    Someone recently posted a function like the one below that I have modified to validate US/Canadian format phone numbers. Sorry that I can't remember the OP to...

  • RE: Replace string after a specific index

    I think I may better use Left in stead of Replace

    SELECT

    CASE WHEN CHARINDEX(' ', Supervisor, CHARINDEX(' ', Supervisor, 0) + 1) > 0 THEN

    LEFT(Supervisor, CHARINDEX(' ', Supervisor, CHARINDEX(' ',...

  • RE: Process deadlock

    It seems the weekend break worked for me to think fresh!!

    I glanced through the query and found that I'm using joins on the columns that are not indexed and as...

  • RE: Process deadlock

    Thanks for your ideas. I'll look into them. By the way, do you mean this below on the usage of alias in UPDATE?

    UPDATE asft SET LastRemoved =...

  • RE: Process deadlock

    You are absolutely correct!! I realized later that my posted query has no impact but the one in the error log has created deadlock!! Any guesses how to tune that?

    It...

Viewing 15 posts - 16 through 30 (of 52 total)