Viewing 15 posts - 4,156 through 4,170 (of 8,731 total)
Please post DDL and sample data to be able to test different possibilities. Be sure to post the expected results based on that sample data.
September 21, 2015 at 12:03 pm
WayneS (9/21/2015)
Alan.B (9/21/2015)
The homework assignment may dictate that the problem be solved with a cursor. Anyone who is good with cursors want to take a look at this?
Anyone good...
September 21, 2015 at 10:15 am
Why did you open this other thread for the same problem?
http://www.sqlservercentral.com/Forums/Topic1721196-391-1.aspx
It only divides the answers and multiplies the efforts of people helping in here.
September 21, 2015 at 10:12 am
You overcomplicate things, Ben. It can all be done in a single query.
This won't solve the whole problem, but it can show how it could be done.
--
-- Create a table.
--
select...
September 21, 2015 at 9:27 am
WayneS (9/21/2015)
Kristen-173977 (9/20/2015)
GilaMonster (9/19/2015)
September 21, 2015 at 9:10 am
That's easier, just remove the GROUP BY (and HAVING) clause as that's only needed if you want to exclude the job numbers that have both operation codes.
September 21, 2015 at 8:53 am
You could change your function to an iTVF (inline table valued function) which should be faster.
Something like this:
--Added an i as prefix to prevent code malfunctions where the original function...
September 21, 2015 at 8:49 am
Here's a simpler option to Scott's query that can be easily converted to the second report.
SELECT
J.DT_ID
,J.OperationCode
,J.EmployeeCode
,J.JobNumber
FROM...
September 21, 2015 at 7:55 am
You might expect that '090471' is equal to '90471' because they have the same numeric value. However, they're different strings.
Here's a code that removes leading zeros to solve this problem....
September 21, 2015 at 5:59 am
Alvin Ramard (9/18/2015)
Jack Corbett (9/18/2015)
September 18, 2015 at 2:20 pm
I completely understand, that's why I mention that it only complies with part of the requirements. However, I wanted to show a better option that will actually help in the...
September 18, 2015 at 2:18 pm
Because T-SQL doesn't like to have flow control.
Don't forget to remove THEN, this isn't VB. 😛
September 18, 2015 at 1:06 pm
Why do they keep teaching this kind of stuff? http://www.sqlservercentral.com/Forums/Topic1720978-169-1.aspx
Then people wonder why there's crappy code everywhere.
September 18, 2015 at 1:01 pm
hyper50 (9/18/2015)
4.You must use a cursor to loop through the GRADE_CONVERSION table to find the letter grade
WHAAAAAAT????? :w00t:
That's actually the best way to return the values by using a cursor....
September 18, 2015 at 12:56 pm
This is a slightly different way. But it will also give different results depending on the data.
Be sure to know what you want.
WITH BASE_DATA AS
(
SELECT
...
September 18, 2015 at 12:22 pm
Viewing 15 posts - 4,156 through 4,170 (of 8,731 total)