Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 update two tables help

Author  Topic 

learntsql

524 Posts

Posted - 2010-02-01 : 09:49:40
Hi...
I have two tables Child table and Master table
Child table contans morethan twenty Datetime columns where i am currently storing Actual dateTime values.
and Master table contains DateID which is autogenerated and DateValue(contains Actual dateTime value) columns.

Now My requirement is I have to update child table's all DateTime Columns ActualData(dateTime) with DateID column data(Master table ID).
What is the best way to update.?
TIA.

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2010-02-01 : 10:38:17
Inner join should work, as long as you are not using hh:mm:ss, or at least setting it all to 0.

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

learntsql

524 Posts

Posted - 2010-02-02 : 00:37:55
In child table it has more than one datetime columns but in master table only one datetime column.
How would be the join condition?
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2010-02-02 : 01:35:26
Could you please post actual table structure and what the expected output should look like?

Harsh Athalye
http://www.letsgeek.net/
Go to Top of Page
   

- Advertisement -