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 |
|
godspeedba
Yak Posting Veteran
90 Posts |
Posted - 2008-11-26 : 10:01:56
|
| This is what I have done so far and fails dramatically with Invalid object name 't'.I tried putting @table t but SQL hates this naming convention and wont let me save it. Any help would be appreciatedCREATE PROCEDURE sp_prop_nomain_photo ASdeclare @table table(propertyid int)Insert into @tableSELECT distinct propertyidfrom tb_photos as tDELETE FROM tWHERE t.propertyid = tb_photos.propertyid AND tb_photos.main_photo = 1 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-11-26 : 10:04:40
|
| [code]Delete tfrom @table t join tb_photos p on t.propertyid = p.propertyid where p.main_photo = 1[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
godspeedba
Yak Posting Veteran
90 Posts |
Posted - 2008-11-26 : 10:12:26
|
| thank you :) |
 |
|
|
|
|
|