Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Pitchfork
Starting Member
4 Posts |
Posted - 2009-12-07 : 12:29:30
|
| I have a query that returns the info I need but need to Update a field:SELECT Job_Operation.Job, Max(Job_Operation.Sequence) AS MaxOfSequence, Job_Operation.Operation_ServiceFROM Job_OperationWHERE (((Job_Operation.Work_Center)='QC') AND ((Job_Operation.Job) Like 'F%') AND ((Job_Operation.Status)='O'))GROUP BY Job_Operation.Job, Job_Operation.Operation_Service;I need to Update the Job_Operation.Operation_Service field to PPAP.I would like to do this so I can schedule it to run every night using SQL Server Agent and Jobs to ran it.Thanks,GregImpulse MFG |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
Pitchfork
Starting Member
4 Posts |
Posted - 2009-12-07 : 13:17:26
|
| The code is from my view called QCOp2PPAP. Can I from the View put a statement to Update the Operation_Service field to PPAP? |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
Pitchfork
Starting Member
4 Posts |
Posted - 2009-12-07 : 13:44:40
|
| The point is I needed to find the max to find the line I need to change. The view or query I am showing is the info I need to change.Job 12345has routings steps that can be dups and I need to change the last QC Seq Work_Center0 Prog Free1 Prod Cond2 Saw3 QC4 WeldMig5 QC6 PowderPaint7 QC8 TransFG |
 |
|
|
Pitchfork
Starting Member
4 Posts |
Posted - 2009-12-07 : 14:59:01
|
| Ok my view is shown below when I get this view I then need to change the column Operation_Service data to read: PPAPUSE [Training]GO/****** Object: View [dbo].[QCOp2PPAP] Script Date: 12/07/2009 14:54:31 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER VIEW [dbo].[QCOp2PPAP]ASSELECT Job, Operation_Service, MAX(Sequence) AS MaxOfSequenceFROM dbo.Job_OperationWHERE (Job LIKE 'F%') AND (Work_Center = 'QC') AND (Operation_Service <> 'PPAP') and (Status = 'O' OR Status = 'S')GROUP BY Job, Operation_Service |
 |
|
|
|
|
|