General discussion
-
Topic
-
Basic SQL (Variable column names)
LockedI have this bit of code:
UPDATE tbl_Legends
SET _1 = ‘#description#’
WHERE Month = ‘#month#’ and Year = ‘#year#’
I currently have 31 if statements to make this work. It would be cleaner to use a loop. My trouble is mssql (or coldfusion?) dose not allow the use of a variable name for the column. I would like to do this.
UPDATE tbl_Legends
SET #x# = ‘#description#’
WHERE Month = ‘#month#’ and Year = ‘#year#’
I am sure this is somthing easy but I have googled for hours and only find stored procedures as a solution. Any help would be great.
All Comments
Viewing 0 reply threads