Insert. Is this possible

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

    Insert. Is this possible

    Hello,

    I have three tables: Posts, Tags and PostsTags.
    Each post is related with various tags through PostsTags.

    Is it possible given a Post with its Tags to save all in all tables in
    one command?

    Or do I need to insert the Post, then the Tags and later the PostsTags
    in the database?

    Just wondering.

    Thanks,
    Miguel
  • shiv_koirala@yahoo.com

    #2
    Re: Insert. Is this possible

    On Sep 29, 5:53 am, shapper <mdmo...@gmail. comwrote:
    Hello,
    >
    I have three tables: Posts, Tags and PostsTags.
    Each post is related with various tags through PostsTags.
    >
    Is it possible given a Post with its Tags to save all in all tables in
    one command?
    >
    Or do I need to insert the Post, then the Tags and later the PostsTags
    in the database?
    >
    Just wondering.
    >
    Thanks,
    Miguel
    If you have defined constraints on table i mean primary key on posts
    and tags with foriegn key on posts tags. I am assuming that the
    posttags is many as to many with post and tags. If this constraint is
    defined you need to first insert in to post and then tags and then
    post tags.

    If you want to insert in go ( i am assuming you are asking from SP
    perspective) you can pass all data as XML and use the selectinto SQL.

    Regards
    Shiv
    http://www.questpond.com ( View free design pattern video)

    Comment

    Working...