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...
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...
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
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?
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...
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...
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.
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...
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...
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...
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...
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...
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...
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...
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...
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...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.