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.
| Author |
Topic |
|
jdub_92
Starting Member
13 Posts |
Posted - 2008-08-18 : 09:55:02
|
| Hi All,I'm new to this transact-sql, i just want to ask if how can i do this registration_date changed to getDate(), it's a one time run only,.I have this two tablestbl1(registration_date, active, status_id)tbl2(status_id, auto_reg,)i want to query all status_id from tbl1 and tbl2 that are active registration and change the registration_date to getDate() where auto_reg value is equal to one(1).registration_date = dateactive , where 0 = inactive and 1 = activestatus_id (integer)auto_reg, where 0 = manual reg and 1 = auto regthanksjwill |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-18 : 09:57:59
|
| [code]UPDATE t1SET t1.registration_date=getdate()from tbl1 t1inner join tbl2 t2on t2.status_id=t1.status_idwhere t1.active=1and t2.auto_reg=1[/code] |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-08-18 : 09:58:42
|
[code]update t1set registration_date = getdate()from tbl1 t1 inner join tbl2 t2 on t1.status_id = t2.status_idwhere t1.active = 1and t2.auto_reg = 1[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
jdub_92
Starting Member
13 Posts |
Posted - 2008-08-18 : 10:43:16
|
| thanks to you guys for the response,. i'll try thisjwill |
 |
|
|
|
|
|
|
|