Avatar of vb2178
vb2178Flag for India

asked on 

Update database based on values in a particular column

I have a database column which I need to update based on values from another column.
Database name: production
Column to be updated: Case Completed
Column to be updated based on: Workflow. Below is sample data.
Workflow ID      Case Completed
538      1
2090      1
5409      1
5538      1
5543      1
5546      1
5548      1
5815      1
5832      1
6162      1
6240      1
6241      1
6365      1
6656      1
6657      1
6658      1
7346      1
7350      1
7352      1
7353      1
7430      1
7431      1
7432      1
7444      1

Column ‘Case Completed’ should be updated to 1 for corresponding values in workflow ID.  Quick TAT appreciated.
Thanks
Microsoft SQL Server 2005

Avatar of undefined
Last Comment
Lowfatspread
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Sorry, but it's not clear what you are trying to do :)
Avatar of vb2178
vb2178
Flag of India image

ASKER

There are around 1600 workflow IDs. Out of this , values for 1300 should be ‘1’ in case completed column.
need to update the case completed column.
And how are we supposed to know which ones should be updated?
Avatar of vb2178
vb2178
Flag of India image

ASKER

I have the set of workflow IDs for which 'case completed' should be 1. A sample is provided in my initial question itself.
Avatar of Lowfatspread
Lowfatspread
Flag of United Kingdom of Great Britain and Northern Ireland image

update yourtable
set [case completed]=1
where [case completed] <> 1
 and [workflow id] in ('xxx','yyyy','zzzz',.....)

or do you have the query which generated the list of workflow ids requiring update?


update yourtable
set [case completed]=1
where [case completed] <> 1
 and [workflow id] in (Select [workflow id] from .... )



Avatar of vb2178
vb2178
Flag of India image

ASKER

Thanks Low fat spread. Can you please tell me how to delete one duplicate entry ie, value '1' in case completed column, if it is updated as 1 for same workflow iDs.

eg: for workflow id '2090' ,case completed is updated as '1'  twice. I need to update one of those entries to '-Select-'.

Help appreciated
ASKER CERTIFIED SOLUTION
Avatar of Lowfatspread
Lowfatspread
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Microsoft SQL Server 2005
Microsoft SQL Server 2005

Microsoft SQL Server 2005 is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning. It includes support for managing XML data and allows a database server to be exposed over web services using Tabular Data Stream (TDS) packets encapsulated within SOAP (protocol) requests.

72K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo