sql server - copying related data using CTE within one SP? -


I have to copy the data for a student (clone student) which includes three tables:

<
  • TblStudent Subjects (where PK is a student student and FK student is Idd)
    1. To complete this, call me

      1. Performing student records by competing with existing student records and getting new students Classes
      2. Create Record student subject to all current students about using new student student and create
      3. Students topic comments recorded using freshman student. Blockquote>

        ... hope you got it

        So, is it a great way to use CTE in a store process? (I am using SQL Server 2005)

  • INSERT and UPDATE statements operate on only one table There are times. You need 3 tables that require INSERTs. You can of course insert several rows in the table in one line, and I think it is good to do it when possible, but you can not put rows in several tables together.

    Think in this way. When you are pulling records in a single result set from several sources, you do the query. When you modify the data, you are pulling records from several sources to apply changes to the same result set.

    Besides, I hate to say this but there are some things that are super-elegant solutions. To ensure that all 3 INSERT statements are in the form of an atomic transaction (all or nothing), your stored procedure needs to implement some best practices, the final result can be vocabulary and fun, but It will be quick, effective, safe, sound and up-to-date.


    Comments

    Popular posts from this blog

    c++ - Linux and clipboard -

    What is expire header and how to achive them in ASP.NET and PHP? -

    sql server - How can I determine which of my SQL 2005 statistics are unused? -