Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Update a 3 column table from a single column

$
0
0
Wasn't sure how to word the title :)I'm working on a method to take user input to update a (target) table named UDFTemp. With some help in a different thread I think I have merge working when I use the same table structures to do the input form a source table (UDFIn)I'd like to see if there is a straightforward way I could do it with a different source structure.The UDFTemp target table is a 4 column table with Unique Index Field (JobNumber), and 3 data fields UDF1, UDF2, and UDF3.The UDFIn source table would be 3 columns with the match/key field, the name of the data field to update and the data to put in the field:e.g.JobNumber, UDFName, and UDF Value.12345, UDF1, Dogs12345, UDF2, Fish12346, UDF1, Cats12346, UDF2, NULLCan anyone show me how I could update the target from such a source? I'm stuck with the translation from UDF1 data field to column name. Thought of using a case but got lost :(

Viewing all articles
Browse latest Browse all 3145

Trending Articles