Click here to Skip to main content
15,898,222 members
Home / Discussions / Database
   

Database

 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? Pin
JTRizos20-Dec-10 11:12
JTRizos20-Dec-10 11:12 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? Pin
PIEBALDconsult20-Dec-10 13:39
mvePIEBALDconsult20-Dec-10 13:39 
AnswerRe: MSSQL - How can I reference a column to update using a variable?? Pin
Jörgen Andersson20-Dec-10 9:39
professionalJörgen Andersson20-Dec-10 9:39 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? Pin
JTRizos20-Dec-10 11:19
JTRizos20-Dec-10 11:19 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? Pin
Jörgen Andersson20-Dec-10 11:34
professionalJörgen Andersson20-Dec-10 11:34 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? Pin
JTRizos20-Dec-10 11:45
JTRizos20-Dec-10 11:45 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? Pin
Jörgen Andersson20-Dec-10 12:30
professionalJörgen Andersson20-Dec-10 12:30 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? Pin
JTRizos20-Dec-10 12:41
JTRizos20-Dec-10 12:41 
Not being able to get the @colname variable to work, here's what I've now been working on. If it works, there will be 100+ case statements. Will what you recommend above work with an Update? My code seems to go through the table being updated once rather than through the CSEEmployeeRoles table which has the multiple records per user. I've done things like this in SQL reports before but never had this problem.

update table1 set
 AuditView = case when table2.SecurityRole='Audit View' and AuditView='No' then 'Yes' else AuditView end,
 BasicArchive = case when table2.SecurityRole='Basic Archive' then 'Yes' else BasicArchive end,
 BasicModify = case when table2.SecurityRole='Basic Modify' then 'Yes' else BasicModify end,
 BasicView = case when table2.SecurityRole='Basic View' then 'Yes' else BasicView end,
 CentralScanOperations = case when table2.SecurityRole='Central Scan Operations' then 'Yes' else CentralScanOperations end,
 CreateorMaintainParticipant = case when table2.SecurityRole='Create or Maintain Participant' then 'Yes' else CreateorMaintainParticipant end,
 CreateRefundParticipant = case when table2.SecurityRole='Create Refund Participant' then 'Yes' else CreateRefundParticipant end,

from EmergencyContact.dbo.CSEEmployeeRoles as table2 right join EmergencyContact.dbo.CSERolesRolledUp as table1
on (table2.EmployeeID = table1.EmployeeID)


Thanx again, Jörgen, for your input.
AnswerRe: MSSQL - How can I reference a column to update using a variable?? Pin
Mycroft Holmes20-Dec-10 16:08
professionalMycroft Holmes20-Dec-10 16:08 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? Pin
Jörgen Andersson21-Dec-10 0:07
professionalJörgen Andersson21-Dec-10 0:07 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? [modified] Pin
JTRizos21-Dec-10 6:04
JTRizos21-Dec-10 6:04 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? Pin
Mycroft Holmes21-Dec-10 11:17
professionalMycroft Holmes21-Dec-10 11:17 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? Pin
JTRizos21-Dec-10 11:40
JTRizos21-Dec-10 11:40 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? Pin
Mycroft Holmes21-Dec-10 13:19
professionalMycroft Holmes21-Dec-10 13:19 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? Pin
JTRizos22-Dec-10 6:26
JTRizos22-Dec-10 6:26 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? Pin
Mycroft Holmes22-Dec-10 11:13
professionalMycroft Holmes22-Dec-10 11:13 
GeneralRe: MSSQL - How can I reference a column to update using a variable?? Pin
JTRizos22-Dec-10 11:48
JTRizos22-Dec-10 11:48 
QuestionExplain Explain for me! Pin
Chris Meech20-Dec-10 7:04
Chris Meech20-Dec-10 7:04 
AnswerRe: Explain Explain for me! Pin
Jörgen Andersson20-Dec-10 10:07
professionalJörgen Andersson20-Dec-10 10:07 
RantRe: Explain Explain for me! Pin
Mycroft Holmes20-Dec-10 16:14
professionalMycroft Holmes20-Dec-10 16:14 
GeneralRe: Explain Explain for me! Pin
Jörgen Andersson20-Dec-10 23:51
professionalJörgen Andersson20-Dec-10 23:51 
GeneralRe: Explain Explain for me! Pin
Chris Meech21-Dec-10 2:11
Chris Meech21-Dec-10 2:11 
GeneralRe: Explain Explain for me! Pin
Chris Meech21-Dec-10 2:16
Chris Meech21-Dec-10 2:16 
QuestionHow to Display transactions happened in sqlserver 2005 Pin
nainakarri19-Dec-10 21:58
nainakarri19-Dec-10 21:58 
AnswerRe: How to Display transactions happened in sqlserver 2005 Pin
Hiren solanki19-Dec-10 22:49
Hiren solanki19-Dec-10 22:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.