We help IT Professionals succeed at work.
Get Started

selecting data range from view

325 Views
Last Modified: 2012-08-13
i created a view that holds a create date column.

on the designer query, i format the create date column to:

 CONVERT(varchar(10), CreatedDT, 101) AS CreatedDT


when I query the view using a date range, the range is not respected and I get results outside of the range.

I wonder if anyone could have a clue of where my error may reside.

I am attaching the code.

Thank you.


 the results from the second query include rows from year 2003
Query that makes the view (LabelDetailSummary):

SELECT     Order_ID, Bndl_Group, Part_Desc, Line_No, SUM(TubeFootage) AS BundleFootage, SUM(TubeWeight) AS BundleWeight, Heat_No, Bndl_Pc_Cnt, Length, Inches, 
                      Fraction, BoxDescription, BoxLength_Feet, BoxLength_Inch, BoxWidth_Feet, BoxWidth_Inch, BoxHeight_Feet, BoxHeight_Inch, BoxWeight, Cust_PO, No_of_Bndls, 
                      Box_Nbr, BoxLength, BoxWidth, BoxHeight, CONVERT(varchar(10), CreatedDT, 101) AS CreatedDT, Label_ID
FROM         Label
GROUP BY Order_ID, Bndl_Group, Part_Desc, Line_No, Heat_No, Bndl_Pc_Cnt, Length, Inches, Fraction, BoxDescription, BoxLength_Feet, BoxLength_Inch, BoxWidth_Feet, 
                      BoxWidth_Inch, BoxHeight_Feet, BoxHeight_Inch, BoxWeight, Cust_PO, No_of_Bndls, Box_Nbr, BoxLength, BoxWidth, BoxHeight, CreatedDT, Label_ID


query to select date range from view:

select order_id,  createdDT
from RG_LabelDetailSummary
where  createdDT between '10/19/2011' and '10/20/2011'
order by order_id, createdDT

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 3 Answers and 11 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE