Unix Technical Forum

inserting one query before another

This is a discussion on inserting one query before another within the SQL Server forums, part of the Microsoft SQL Server category; --> I am having trouble inserting two queries...I am trying to insert an new item(pk) into a table in one ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 05:35 AM
bockley
 
Posts: n/a
Default inserting one query before another

I am having trouble inserting two queries...I am trying to insert an
new item(pk) into a table in one query, and then inserting an item(fk)
in another table that relates to the other item just created in the
first. The problem is that in order for the second query to work, the
first has to exist in the first table before it will work. Is there a
way of running the first query first and then the next. Here is what I
have:

<cfquery name="q_insert" datasource="#dsn#">
INSERT INTO eccn
(eccn_num,
eccn_brief_descrip,
eccn_full_descrip,
eccn_reason_controlled)
VALUES( '1D001',
'TEST',
'TEST INPUT AND SEARCH',
'TESTING THE INPUT AND SEARCH PERFORMANCE')
</cfquery>
<cfquery name="q_insert2" datasource="#dsn#">
INSERT INTO eccN_interrelationship
(eccn_num,
related_eccn_num)
VALUES('1D001',
'1B001')
</cfquery>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 05:35 AM
Dishan Fernando
 
Posts: n/a
Default Re: inserting one query before another

You can run both at once.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:52 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com