troubleshooting Question

SQL Select Statement

Avatar of jampost
jampostFlag for United States of America asked on
.NET ProgrammingMicrosoft SQL Server 2008
2 Comments1 Solution427 ViewsLast Modified:
I tried this through Visual Studio and Lastly entering it directly into SQL Server Management Studio where I received 38 Error lines. It looked like virtually everything was rejected with red zigzag underlines. I am not sure where I am going wrong. Example in SQL Management Studio______  Query window on the right with this query filled in. I hoovered the cursor over      ORDER BY OrderDate         "I get "invalid column name"           I look on the left at the columns listed under CustomerOrders table and there is is  a column called OrderDate  with data type (Date, Null)            By the way   in the where clause         WHERE        (OrderComplete = '0')             OrderComplete has data type bit        I just want to show orders that are not complete.

The following is definitely true in SQL Server  (Nothing is networked  -  all is local):

Data base name:     jandmmfg
Table used: dbo.CustomerOrder

I won't repeat the fields here, but they were auto filled in in Visual Studio where I am developing a program. I checked most of them and they were right. But like I said; everything was rejected so I am guessing that something obvious is wrong or missing.

SELECT        OrderNumber, CustomerNumber, Contact, OrderDate, ShipDate, OrderComplete, [Drop Ship info?], [Freight Charges], Item_a_Qty, Item_a_description, Item_b_Qty,
                         Item_b_description, Item_c_Qty, Item_c_description, Item_d_Qty, Item_d_description, Item_e_Qty, Item_e_description, Item_f_Qty, Item_f_description, Item_g_Qty,
                         Item_g_description, Item_h_Qty, Item_h_description, Item_i_Qty, Item_i_description, Item_j_Qty, Item_j_description, Item_k_Qty, Item_k_description, Item_l_Qty,
                         Item_l_description, Item_m_Qty, Item_m_description, Notes
FROM            CustomerOrders
WHERE        (OrderComplete = '0')
ORDER BY OrderDate
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros