| Author |
Topic |
|
Easwar
Yak Posting Veteran
59 Posts |
Posted - 2007-03-23 : 02:24:00
|
| I need three insert query into only one single query at a time .It's possible... |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-23 : 03:27:53
|
| No.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-23 : 04:17:47
|
can you explain more in detail ? KH |
 |
|
|
Easwar
Yak Posting Veteran
59 Posts |
Posted - 2007-03-23 : 04:41:33
|
| This is my sample table Datatable1TopicID|Topic-------|--------1|kkj2|kjgg 3|jhkj.........This is first insert (TopicID is primary Key)table2TagID|TagName-----|--------1|xyz2|123abc3|a3bc.......this is second insert (TagId is primary key)table3DetID|TagID|TopicID-----|-----|------------1|1|12|1|23|1|34|2|4.......this is 3rd insert (DetID is primary Key| TagID & TopicID is forgien key)any query(single) |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-23 : 04:46:22
|
Why single query ? What's wrong with 3 insert statement ? KH |
 |
|
|
Easwar
Yak Posting Veteran
59 Posts |
Posted - 2007-03-23 : 04:53:45
|
| when i first insert Topic into table1.... that time automatically insert the TopicID into table3. the same way when i insert TagName into table2.. That time automatically insert the TagId into table3.It's possible.. any query(otherwise update query) |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-23 : 04:55:05
|
quote: Originally posted by khtan Why single query ? What's wrong with 3 insert statement ? KH
Oh...come on, KH!!Don't you know it takes 6 keystrokes just to copy and paste lines 3 times. Plus few more to make appropriate changes...my fingers hurts with that much coding... Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-23 : 05:00:40
|
quote: Originally posted by Easwar when i first insert Topic into table1.... that time automatically insert the TopicID into table3. the same way when i insert TagName into table2.. That time automatically insert the TagId into table3.It's possible.. any query(otherwise update query)
"when i first insert Topic into table1.... that time automatically insert the TopicID into table3"How to auto insert into table3 when you don't have the Tag_ID ?Why not just create a stored procedure, pass in Topic, TagName and the stored procedure will insert into the 3 table ?Is the TopicID, TagID an identity column ? KH |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-23 : 05:01:30
|
quote: Originally posted by harsh_athalye
quote: Originally posted by khtan Why single query ? What's wrong with 3 insert statement ? KH
Oh...come on, KH!!Don't you know it takes 6 keystrokes just to copy and paste lines 3 times. Plus few more to make appropriate changes...my fingers hurts with that much coding... Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
 KH |
 |
|
|
Easwar
Yak Posting Veteran
59 Posts |
Posted - 2007-03-23 : 05:06:50
|
| i don't know stored procedure.. plz tell me coding.. help me |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-23 : 05:07:42
|
Is the TopicID, TagID, DetID an identity column ? KH |
 |
|
|
Easwar
Yak Posting Veteran
59 Posts |
Posted - 2007-03-23 : 05:09:06
|
| yes |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-23 : 05:25:41
|
Post back if you have problem with the stored procedure. At least give it a try first. KH |
 |
|
|
|