Forum Replies Created

Viewing 15 posts - 4,336 through 4,350 (of 10,144 total)

  • RE: previous week query 0700 - 0700

    jerome.morris (7/19/2013)


    I just wondered, if I am passing the week number to sql from c# I am going to have a problem when its week 1, because to get last...

  • RE: previous week query 0700 - 0700

    Check your connections. Could you be connected to two different versions of the db, in in VS, the other in SSMS?

  • RE: previous week query 0700 - 0700

    jerome.morris (7/19/2013)


    Yes I do now find that strange considering I have data in there for last week?

    You now get "no results for last week" from several queries which you've run....

  • RE: previous week query 0700 - 0700

    jerome.morris (7/18/2013)


    Hi Chris that returns data within them dates.

    Thanks

    jerome.morris (7/19/2013)


    (No column name)(No column name)

    2013-07-08 07:00:00.0002013-07-15 07:00:00.000

    the rest of the data is empty

    Jay

    Don't you find this a little odd? If I...

  • RE: previous week query 0700 - 0700

    Firstly, I wouldn't recommend embedding queries within your c# code, it makes it ten times harder to maintain, IMHO. Call views or stored procedures instead.

    Secondly, your first post stipulates a...

  • RE: previous week query 0700 - 0700

    jerome.morris (7/19/2013)


    (No column name)(No column name)

    2013-07-08 07:00:00.0002013-07-15 07:00:00.000

    the rest of the data is empty

    Jay

    The two dates displayed are the range start date and range end date variables.

    SELECT @RangeStart, @RangeEnd

    These...

  • RE: previous week query 0700 - 0700

    jerome.morris (7/19/2013)


    Hi Chris is I get the curent week number from my app then pass to sql along the way off

    Select * from dbo.DocketTB Where DatePart(Week,Docket_EngFinish ) = @weeknum

    can...

  • RE: previous week query 0700 - 0700

    This batch:

    DECLARE @RangeStart DATETIME, @RangeEnd DATETIME

    SELECT

    @RangeStart = x1.MondayLastWeek,

    @RangeEnd = DATEADD(DD,7,x1.MondayLastWeek)

    FROM (

    SELECT MondayLastWeek = DATEADD(hh,7,CAST(CAST(DATEADD(DD,-((DATEDIFF(DD,0,GETDATE())%7)+7),GETDATE()) AS DATE) AS DATETIME))

    ) x1

    SELECT @RangeStart, @RangeEnd

    SELECT *

    FROM dbo.DocketTB

    WHERE Docket_EngFinish BETWEEN @RangeStart...

  • RE: previous week query 0700 - 0700

    How are you executing this test batch, Jay? Are you using SSMS?

  • RE: previous week query 0700 - 0700

    jerome.morris (7/18/2013)


    Hi Chris that returns data within them dates.

    Thanks

    Time to put this one to bed. Can you post up the results of this batch please?

    DECLARE @RangeStart DATETIME, @RangeEnd DATETIME

    SELECT

    @RangeStart...

  • RE: previous week query 0700 - 0700

    jerome.morris (7/18/2013)


    The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

    Oops sorry my mistake:

    SELECT *

    FROM dbo.DocketTB

    WHERE Docket_EngFinish BETWEEN '20130708' AND '20130715'

  • RE: Identity property

    John Mitchell-245523 (7/18/2013)


    Koen, are you sure about that? You can add a new column with an identity property, but I can't see any way of adding the identity property...

  • RE: Prev and Next Row Without RowNumber

    Khalid Hanif-458693 (7/18/2013)


    Dwain,

    Thanks for the great idea, instead of the computed column, I used the bigint column with all the values.

    working like a charm with index seek.

    Khalid, I'd be fascinated...

  • RE: check if index exists

    riya_dave (7/17/2013)


    hi

    i am creating script for non clustered ,

    i need to see of particular index on column on particular table exists or not

    Use object explorer in SSMS.

    It's not usually as...

  • RE: previous week query 0700 - 0700

    What's returned from this, Jerome?

    SELECT *

    FROM dbo.DocketTB

    WHERE Docket_EngFinish BETWEEN '20130708' AND '20131508'

Viewing 15 posts - 4,336 through 4,350 (of 10,144 total)