Table locking

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Per

    Table locking

    I want to insert values into a table and the same time select a value
    from the same table.

    I insert a record of a parent type and use a function to create a
    subscriberType for the record.

    Next i insert a record of child type and want to select the
    subscriberType from the parent record.

    This do not work when i use

    INSERT TABLE
    SELECT ,Name
    ,"function to generate subscribertype"
    ,.............

    I DO NOT WANT TO USE CURSOR!!
  • Simon Hayes

    #2
    Re: Table locking


    "Per" <per-eivind-greva.sivertsen @cgey.com> wrote in message
    news:e8e9626f.0 309112349.59059 b25@posting.goo gle.com...[color=blue]
    > I want to insert values into a table and the same time select a value
    > from the same table.
    >
    > I insert a record of a parent type and use a function to create a
    > subscriberType for the record.
    >
    > Next i insert a record of child type and want to select the
    > subscriberType from the parent record.
    >
    > This do not work when i use
    >
    > INSERT TABLE
    > SELECT ,Name
    > ,"function to generate subscribertype"
    > ,.............
    >
    > I DO NOT WANT TO USE CURSOR!![/color]

    It's not clear how you create the subscriberType. If it's based on the
    properties of the parent record, then you may be able to generate the type
    before doing any of the INSERTS:

    declare @type int
    set @type = dbo.GenerateTyp e(ParentName)

    insert into dbo.MyTable
    select ParentName, @type

    insert into dbo.MyTable
    select ChildName, @type

    But that's just a guess - without more information (table structure, how you
    generate the type etc.), it's not possible to give a better answer.

    Simon


    Comment

    Working...