need help in data parameters

  • Hi, ALL

    the code that i have gives me the data from a week, but now i want to chage it to generate dara from a month

    (

    select convert(varchar(10), Date, 101) as WeekName, DateAdd(day, -6, Date) as WeekStartDate, Date as WeekEndDate

    from [xxx_xxxx_xxx].[dbo].Calendar

    where Weekdayname = 'Friday'

    --and year = 2010

    and Date BETWEEN @STARTDATE AND @ENDDATE

    )

    i have to use this report in the matrix report the rums every onth first and gives me data of the previous month

    thanks for looking into it

  • It looks to me like what you need to do is change the parameter values. What am I missing?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • here are the data parameters

    STARTDATE =CDate("01/01/" + Cstr(Year(Today)))

    ENDDATE =Today

  • Are you looking for something that will select all the start and end dates for months between 1 Jan and the current date?

    If so, can't you just select the first date of each month from your calendar table?

    select Date, dateadd(day, -1, dateadd(month, 1, Date)) as EndDate

    from MyCalendarTable

    where DayOfMonth = 1

    and CalendarYear = datepart(year, getdate());

    (I'm making assumptions about your Calendar table. Let me know if any of my column names don't make sense to you.)

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • should i use the same data parameters

  • Are the parameters actually dynamic, or are they always 1/1/thisyear and Today?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Hello comunity

    I create a simple select statment whith a variable, for example:

    declare @numcli int

    set @numcli = 11

    select name,adress from customers where customers.no = @numcli

    In ACCESS, when i define a parameter and i execute my query, before the execution a dialogbox open to put on them the value that i wish for my variable.

    The same thing is possible in SQL Server, because i don´t find anything about that, so the use of variable in SQL like my example is not dynamic .

    Many thanks

    Luis Santos

  • luissantos (10/26/2010)


    Hello comunity

    I create a simple select statment whith a variable, for example:

    declare @numcli int

    set @numcli = 11

    select name,adress from customers where customers.no = @numcli

    In ACCESS, when i define a parameter and i execute my query, before the execution a dialogbox open to put on them the value that i wish for my variable.

    The same thing is possible in SQL Server, because i don´t find anything about that, so the use of variable in SQL like my example is not dynamic .

    Many thanks

    Luis Santos

    Please post this as a separate thread.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply