Reputation: 91
SELECT clientLastName__c, clientFirstName__c, clientID__c, Category_ID__c,
ID AS Incident__c, OwnerId, SystemTypeDesc as taskDescription__c
FROM process.dbo.vw_NewHireProcess
WHERE System_Type__c IS NOT NULL`
I'm not sure how to update the OwnerId field with a specific value, but I don't want to change the name of the column.
Upvotes: 1
Views: 171
Reputation: 2617
Like this:
select clientLastName__c,
clientFirstName__c,
clientID__c,
Category_ID__c,
ID AS Incident__c,
'95939439uuxx' AS OwnerId,
SystemTypeDesc as taskDescription__c
from process.dbo.vw_NewHireProcess
Where System_Type__c IS NOT NULL
Good luck!
Upvotes: 1
Reputation:
If you just want to return a constant value as the ownerid column, you can do the following:
select clientLastName__c,
clientFirstName__c,
clientID__c,
Category_ID__c,
ID AS Incident__c,
42 as OwnerId,
SystemTypeDesc as taskDescription__c
from process.dbo.vw_NewHireProcess
Where System_Type__c IS NOT NULL
If you want to return a different value for ownerId based on the value in that column you can do something like this:
select clientLastName__c,
clientFirstName__c,
clientID__c,
Category_ID__c,
ID AS Incident__c,
case
when OwnerId < 100 then -1
when OwnerId >= 100 and ownerId < 1000 then 1
else 42
end as ownerId
SystemTypeDesc as taskDescription__c
from process.dbo.vw_NewHireProcess
Where System_Type__c IS NOT NULL
But none of those will change the value that is stored in the database. It's merely a replacement while you select the values.
Upvotes: 0
Reputation: 77934
You don't need to change your column name. You can update like
UPDATE process.dbo.vw_NewHireProcess
SET OwnerId = 'New Value whatever you want' WHERE OwnerId = 'Current Value'
Upvotes: 1
Reputation: 48597
You will need to alter the values, but this is the layout for an UPDATE
statement:
UPDATE yourTableName
SET OwnerId = yourValue
WHERE yourWhereClause
Upvotes: 1