Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. bminaeff

    Update 1 of multiple records

    Hello All, I have an application where I am fed some data by some equipment and log this data to a table. One of my inputs is a unique number which allows me to identify a record, but it is not a primary key because under certain circumstances my input may be a constant = '?????'. So I may get...
  2. bminaeff

    Get count on a query?

    Changing out COUNT for SUM seems to do the trick. So my query now looks like this: Declare @Status Char(1) SELECT @Status = Status FROM ContData WHERE TruckNum = 'Truck_123' SELECT ContNum, @Status, DoorNum, RecDate,SUM(CASE WHEN cartonid <> '???????????????????' THEN 1 ELSE 0 END) as...
  3. bminaeff

    Get count on a query?

    SELECT ContNum, DoorNum, RecDate,COUNT(CartonID) as total,SUM(CASE WHEN cartonid = '???????????????????' THEN 1 ELSE 0 END) as Totalunknown FROM Details WHERE ContNum = 'Truck_123' GROUP BY ContNum, DoorNum, RecDate This seems to work. Thanks SQLSister
  4. bminaeff

    Get count on a query?

    SQLSister has the right idea, I need the total count and the number of CartonID's that are just question marks. However, my query always returns with the Totalunknown being the same as the total and this isnt true. Any idea why?
  5. bminaeff

    Get count on a query?

    Hello all, I have a query that I am working on and I need to add another field to it, but I am unsure how to do it. Here is my current working query. I need to add in a count of CartonID's where the CartonID = '?????????'. Any ideas how to do this? SELECT ContNum, DoorNum...
  6. bminaeff

    Selecting records based on sperated date and time fields

    I have a table with two columns one is the date and one is the time so for example one records date might be '06/20/08' and its time might be '08:52:32:140'. I need a stored procedure to return back the counts of another field where the date and time is later than some date/time input parameter...
  7. bminaeff

    Two questions. Stored proc not working and conceptual question.

    Nevermind. I forgot to set the lane assignment under the multiple record condition. Anyway, my other question still stands, but the code seems to work.
  8. bminaeff

    Two questions. Stored proc not working and conceptual question.

    Hi All, I have two questions, but that are somewhat related. First one is more important. I have to write a stored procedure that is overall pretty simple, but I am just not sure the best way to do it. I originally wrote one and it seemed to work, but I figured there was a better and/or more...
  9. bminaeff

    Question about record numbers

    Hi all, I have a question about whats the best way to keep track of a records number. I am probably going to phrase this poorly, so thanks for sticking with me. Lets say I have 5 records. I insert them to a table and one of the columns in my table is a record number, so values in this case...
  10. bminaeff

    New SQL rowcount question

    Hey all, I have this Stored Procedure that works well but for some reason the first @@RowCount does not seem to work. Instead of giving me @Reject, '03' , and '000' it gives me all nulls when I search for a UCC_bc that does not exist in UCC. The other RowCounts work fine, but I can not see what...
  11. bminaeff

    IF THEN ELSE Problems

    George, Thanks for the help. This seems to be working now. Its actually not that hard once you get the syntax down.
  12. bminaeff

    IF THEN ELSE Problems

    George, I am not much of a SQL guy, so most of what I am doing is probably wrong. I just told my SQL guy what I can give and what I need out and I only know what I have doesnt work. Anyway, I should have DCID as DC_bc. I am giving the SP three values that come from a barcode scanner through a...
  13. bminaeff

    IF THEN ELSE Problems

    Hey all, I am new to doing if then else's in SQL and I am having a tough time. The Errors I am receiving are the following: Msg 156, Level 15, State 1, Procedure Lane_Destination_R2, Line 72 Incorrect syntax near the keyword 'THEN'. Msg 102, Level 15, State 1, Procedure Lane_Destination_R2...
  14. bminaeff

    Reading txt file

    Trenta, I thought I had something similar to your needs, but mine looks through multiple files in a folder. Anyway, I tried to modify it a little to your needs but its not there yet. You want to change the for loop but this will show you how to read a textfile and parse that data. Hope it...
  15. bminaeff

    values changing back to default, why is that?

    Hi all, I have a program that is supposed to log data to a sql table based on a serial port receiving data. When I get a start of text and return I call this routine below. I set some other parameters up previously by a button click, as shown even lower. The problem I am having is that when I...
  16. bminaeff

    Order By time question

    That works great, thanks alot genomon
  17. bminaeff

    Order By time question

    Hi all, I have a requirement where I get a time in "HH:MM AM/PM" format so for example I might get three times of "11:55 AM" , "12:39 AM" and "1:05 PM" sent over to me. I have to log this to a table and sort it in descending order. The problem is that the "1:05 PM" is then placed below the...
  18. bminaeff

    Creating new tables and deleting old ones

    Thanks Guys, I was trying to avoid using dynamic SQL, but I thought I could do it that way. -Bill
  19. bminaeff

    DataGridView being populated programmably

    RiverGuy, I am getting the data from an SQL 2005 table, but the table will be varying. -Bill
  20. bminaeff

    DataGridView being populated programmably

    Hi all, Does anyone have a good example or guide that shows how to programmably fill a datagridview? I have always used the wizard, but now I have a requirement to use a datagridview to view data in varying tables. If anyone has anything on this I would appreciate it. It seems that there is...

Part and Inventory Search

Back
Top