Microsoft
Software
Hardware
Network
Question : How to convert a SELECT statement into an UPDATE statement using SQL Server 2005?
I am developing an application in ASP and I use SQL Server 2005.
How would you convert the following SELECT statement into an UPDATE statement so that
userid is changed from 'dreed' to 'apagan'
SELECT dbo.tSOXUsrRequest.reqID, reason, tSOXUsrRequest.appname,
dtneeded, tSOXUsrRequest.userid, tSOXUsrRequest.userName,
tSOXUsrRequest.userEml, tSOXUsrRequest.changeReque
st,
tSOXUsrRequest.dtrequested
, tSOXUsrRequest.devID, tSOXUsrRequest.dev
FROM tSOXUsrRequest LEFT OUTER JOIN tSOXSignOFF
ON tSOXUsrRequest.reqID = tSOXSignOFF.reqID WHERE
(tSOXSignOFF.usrSignOff IS NULL)
AND dev = 'bill_lee' and userid = 'dreed'
Answer : How to convert a SELECT statement into an UPDATE statement using SQL Server 2005?
Try this
UPDATE R
SET R.userid = 'apagan'
FROM tSOXUsrRequest R LEFT OUTER JOIN tSOXSignOFF O
ON R.reqID = O.reqID
WHERE (O.usrSignOff IS NULL)
AND R.dev = 'bill_lee' and R.userid = 'dreed'
Random Solutions
Fortigate 60 - Webfiltering - allow some users
Exchange 2007 Certificate Renewal
CRM 4.0 - Contracts Expiring at a specific time?
Domain trust between Windows Server 2008 R2 and Windows Server 2003
SQL 2008 upgrade creates two separate instances
Exchange 2007 OWA causes 2 audit failures on failed login attempt
How to Populate a ListBox Control with Values from an Access Database Table
Server 2008 NLB problem
Ways to merge files in linux
lotus script to check the groups