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 |
|
Apples
Posting Yak Master
146 Posts |
Posted - 2008-04-19 : 18:36:41
|
| Here are my tables:-------------------------------Events-------------------------------ID | E_EventName--------------------------------------------------------------Photos-------------------------------ID | P_EventID | P_Filename-------------------------------Given an event like "2005 cookout", and a file like "bob.jpg", I'd like to insert the event id based on the event name and the filename into Photos. How can I do that? |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-04-19 : 19:05:12
|
| insert into Photos (ID, P_EventID, P_Filename)select yourId, E.id, 'bob.jpg'from Events Ewhere E_EventName = '2005 cookout'chage yourId to the id you ned or remove it if it's auto created_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
|
|
|