Insertion of records in two different tables at the same time?

Hello everyone, I have question about inserting records in two different tables at the same time, I'm looking for is by the way a unique id, which is created in the first statement insert to the second insert statement. Example of this problem:

< cfquery name = "addRecords1" datasource = 'test' >

Insert Into Table1 (name, Date, age)

Values (< cfqueryparam cfsqltype = "cf_sql_char" value = "#arguments.) "Name # ' >.

< cfqueryparam cfsqltype = 'cf_sql_date' value = '#arguments. "Date # ' >.

< cfqueryparam cfsqltype = "cf_sql_int" value = "#arguments. Age #"(>); "

Select SCOPE_IDENTITY() as RecID;

< / cfquery >

< cfquery name = "addRecords2" datasource = 'test' >

Insert into Table2(Company,City,Date,ID)

Values (< cfqueryparam cfsqltype = "cf_sql_char" value = "#arguments.Company #" >,)

< cfqueryparam cfsqltype = "cf_sql_char" value = "" #City # ">,"

< cfqueryparam cfsqltype = 'cf_sql_date' value = "" #Date # ">,"

( < cfqueryparam cfsqltype = "cf_sql_int" value = "How to pass RecID to insert in this table?" >).

< / cfquery >

In this example, I'm inserting records in table 1 and creation of IDENTITY SCOPE as RecId. I would like to pass this id and insert it in my table 2. This Id, I'll use in my second table as an identifier. If anyone knows anything about this please let me know. Thank you.

);

QueryName - DOT - ColumnName, so it should be:

);

HTH,

^_^

Tags: ColdFusion

Similar Questions

  • Possibility to delete records in two different table in the same DB

    Regarding the title of the Message, if it is possible, please show me the SQL (using MS SQL 2000) command to perform this operation. Thank you very much.

    clixmax wrote:
    > Regarding the title of the Message, if it is possible, please show me the SQL code
    > command (using MS SQL 2000) to perform this operation. Thank you very much.

    SET NOCOUNT ON

    REMOVE tableOne
    WHERE someCondition = #form.someCondition #.

    REMOVE tableTwo
    WHERE someCondition = #form.someCondition #.

    SET NOCOUNT OFF

  • possible to have 2 different application fields for two different clips at the same time

    Hello

    possible to have 2 different application fields for two different clips at the same time for the classification match in terms of the scope, only not to the eye?

    Not that I know of.  And Yes, it would be very useful. As would the ability to go back 2 in reading monitor and a button "game clip under the read head 1. Sigh.

    Neil

  • appearing in two different colors at the same time container attached screenshot.

    post.JPGHello

    I am very impressed with this site's Look, you can see that
    in this the container showed up in two different colors at the same time as shown in the attached screenshot.

    Please tell me how to get there?

    A part is loading advertising and other view their business rules.

    Please tell me how to get this behavior

    Because when I use the Application container = 'black' background color, it displays the container integer oiail color.

    Help, please

    Thanks in advance.

    There are many ways to achieve this. We can be to use the background image for the application. Other means may be to use various containers (Panel, canvas etc with background pictures) to get this look. Think of it in HTML view. How you can use the div tags to your page layout, you can use various containers of Flex to your page layout.

  • can I display different tables at the same time?

    Hi all

    It is probably a newbie question, but is it possible to display different tables at the same time? I use SQL Developer 1.5.5 and I seem to be unable to display several tables at the same time, whenever I chose to open another table, the old table disappears. In other words, the Bulletin Board only switches to your new choice in the table list navigation. Any ideas anyone?

    Kind regards
    WF

    Menu item "Tools-> Preferences-> database-> ObjectViewer Parameters"; Make sure that "automatically freeze object viewer Windows" is checked.

    HTH.

    Hrsg.:.

  • How to run two 'County of buffered edge' using two different counters at the same time?

    Hello

    I try to use two counters at the same time count the TTL pulses for a fixed period (lets say 10 ms). I have the card PCI-6251 and PCI-6601. I am currently using PCI 6601 as counters and running a self updated the ' stamped edge County - reset.VI. Here, I have attached my VI.

    Now, during the execution of this VI, I get an error saying "error-200251 occurred at Task.vi:4 DAQmx Start" and the possible reasons are, "measures: no USB or DMA channels in loose ends are available.»

    Either stop other tasks which might be using these resources or are considering changing your mechanism for transfer of data to the interruptions if supported.

    Device: Dev2

    Task name: _unnamedTask<80>. »

    What I realized is I'm trying to use two buffers for two meters with ten samples each and this is probably not allowed. I don't know how to solve this out and bad looking for your suggestions.

    Thanks in advance.

    Hi all

    I found a solution too. This is the VI updated the "County of edge stamped" which can simultaneously run two entries-meter using a single source of door and it also uses the DMA and interrupts to save two pads.

    Have a nice weekend.

  • How to open two different images at the same time to work on it together please?

    Please help, I am at a loss to open the two images at the same time to work together on them. can someone help please

    I suspect that, in this point of you familiar with the functionality of Photoshop, you may prefer the following:

    Choose Preferences > Interface > and uncheck open as tabs Documents

    Then, when you open two images they both will appear on the screen.

    At a later time, you may want to work with her alternate: the tabs option.

  • Is it safe call a function of two different thread at the same time?

    For example,.

    Thread1()

    {

    status = my_function();

    }

    Thread2()

    {

    status = my_function();

    }

    int my_function()

    {

    foo;

    return the result;

    }

    I want to call thread1 and thread2 ma_fonction at the same time.

    Call functions simultaneously, in itself and is not a problem at all. Each thread has its own stack of appeal.

    However, you carefully examine the foo part. If you access resources overall (such as hardware devices, global variables or static local variables), or if you make calls to non thread-safe libraries, then you will have to lock the bits of sensitive code with thread locks, ensuring as well as only one thread can access this code at any time.

    Luis

  • * Creating Cloud * [can I use two different applications of cloud on different computers at the same time for example Photoshop on one and on another InDesign?]

    So I know that you can have creative cloud up to two computer and its not of platform specific, so you can have it on a Mac and the Windows platform at the same time. BUUUT I know that you can not use them simutaniously, but which still apply to the when im I need to work on photoshop on only one computer and indesign on another who would always use them at the same time so he would evict me? or can be used on two different programs at the same time?

    Always there was confusion on this issue.

    Adobe said yes in 2012 and 2014.

    Running different applications - 2 computers, a single license

    Contradictory information on the simultaneous use of CC.

    Don't know the current position of Adobe.

  • Could a NI6008 be shared by two software programs at the same time?

    Hello

    I wrote two software with Labwindows/CVI for different purposes. Two of them are using NI6008. I have only one ni6008 attached to my laptop. I can run two programs at the same time? I mean, it's a NI6008 could be controlled by two different software at the same time? Thank you!

    Best,

    Shang

    Shang,

    There are four types of tasks, AO, DIO and counter. You can have one of each performer both on a USB-6008.

    Kind regards

    Kyle Mozdzyn

    Engineering applications

    National Instruments

  • Is it possible to use two different computers with the same adobe - ID and the same adobe license?

    Is it possible to use two different computers with the same adobe - ID and the same adobe license?

    Hi Morten,

    Yes, you can have your subscription or your license installed on two different computers with the same adobe id, however use one at a time.

    Please let us know if you have any questions, more about it.

  • How to divide the screen into two parts in order to see the two different parts of the same file? [Suggestion] [Android]

    I am Brazilian and I use Adobe Acrobat Reader DC a lot. I would suggest an implementation of features present in the PC, I missed a lot of things on Android, which is 'New window' or something like that, like split the screen into two parts in order to see the two different parts of the same file.

    For smartphones, its use is restricted, but for tablets, it can be really useful, because it allows the display of two distinct points of the same file,

    I have reduced considerably the use of paper using this application, however, I need to navigate the file always pick up a few points seen earlier, which causes a lot of discomfort compared to printed documents.

    This is a suggestion, but I would like it to be considered.

    Thank you for your request. We have taken note of the same and must try to integrate it into one of our future releases.

    Thank you.

  • Culture in two different places in the same page

    What on Earth, I want to crop in two different places in the same page. For example, I want to keep something in the upper part and something in the lower part, but skip the other parts. What happens on Earth, I can do that, gentlemen?

    There is a rectangle of cropping by page.  What the parties 'ignored' would look like? Flat white?

  • How to find the same column name in different tables in the same schema

    Hello

    I find the 'ename' column name in different tables in the same schema.

    Thank you
    Nr

    Hello

    Try this query

    Select column_name, table_name from user_tab_columns where column_name = 'ENAME ';

    Award points and end the debate, if your question is answered or mark if she was...

    Kind regards

    Lacouture.

  • Remove two tables at the same time

    Hello
    Is there any way to remove many tables at the same time?

    delete from tbl1, tbl2.

    Thank you

    953402 wrote:
    Hello
    Is there any way to remove many tables at the same time?

    delete from tbl1, tbl2.

    Thank you

    NO.

    Consider actually Read The Fine Manual below

    http://docs.Oracle.com/CD/E11882_01/server.112/e26088/TOC.htm

Maybe you are looking for