May 15, 2015 at 10:11 am
Hi,
i have task where i need to update the 2 columns from 2 different tables.I need to get one column from one table and update to the other table.If the column name do not match....Please help
May 15, 2015 at 10:29 am
bpsavi123 (5/15/2015)
Hi,i have task where i need to update the 2 columns from 2 different tables.I need to get one column from one table and update to the other table.If the column name do not match....Please help
Hi and welcome to SSC. We can help but we need some information. And for the record we will want to avoid cursors in nearly every situation as they are horrible for performance.
To help you with your current problem please take a look at the first link in my signature for best practices when posting questions.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
May 15, 2015 at 10:34 am
bpsavi123 (5/15/2015)
Hi,i have task where i need to update the 2 columns from 2 different tables.I need to get one column from one table and update to the other table.If the column name do not match....Please help
I have to agree with Sean. Really can't help you with what little info you provided. Also, cursors have their uses but in this case it may not be the correct option.
May 15, 2015 at 4:42 pm
As others said, more details: good, cursor for this: bad.
It sounds like you can accomplish what you are trying to do with two update statements.
-- Itzik Ben-Gan 2001
May 15, 2015 at 6:06 pm
bpsavi123 (5/15/2015)
Hi,i have task where i need to update the 2 columns from 2 different tables.I need to get one column from one table and update to the other table.If the column name do not match....Please help
Update using a WHERE NOT EXISTS using a correlated sub-query of the two tables.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply