stored procedure to insert data into table from another table
stored procedure to insert data into table from another table
Alibabacloud.com offers a wide variety of articles about stored procedure to insert data into table from another table, easily find your stored procedure to insert data into table from another table information here online.
Sometimes, we need to migrate the data from a table to a different Couchen of the same structure by exporting it all or based on query criteria
Currently, there is no relevant tool in SQL Server to generate INSERT statements based on query criteria, only with the help of Third-party tools (third party tools)
There ar
In the project, you need to generate an Insert script for the data in the table, and find a stored procedure from the Internet. However, if an error is reported during execution, you can modify and debug it.
Added support for SQL
Table A has A field primary key, ID, name, and evaluation score. Table B has A field primary key, key, and description. the evaluation score corresponds to the key. then Table B is A status table (for example, there are data rows: Satisfied, general, negative rating) current
Label:EXEC sp_addlinkedserver
@server = ' cqq ',--the server alias that was accessed (habitually using the target server IP directly, or taking an individual name such as JOY)
@srvproduct = ' ms ',
@ Provider= ' SQLOLEDB ',
@datasrc = ' 172.18.5.9 '--the server to be accessed
EXEC sp_addlinkedsrvlogin
@rmtsrvname = ' cqq ',-- The server alias being accessed (if the alias joy is used in the sp_addlinkedserver above, Joy is also here)
@useself = '
For example:Table A Table B Table CSN1 contect1 Sn2 conect2 help1. Hello. 1. Yes. Hello./very good./General./Yes./indeed./Yes./hello.2. Good. + 2. How are you doing?3 General situation4. Yes.5 is really good
That is to say, the content of the conect field in a and B is combined into the help field in
Recently, SQL stored procedures have been found to greatly reduce the amount of code in the program.
In the future, we need to consider using more stored procedures.
Two tips:
1. Use stored procedures to dynamically create data tables.
/*Process function: dynamically create a data
Label:Ask your teacher a question, if you want to set up a table and insert data into a stored procedure, what should be done, if the table inserted into the data is not established before inserting
The insert SQL statement used to export the joined table in the stored PROCEDURE. To facilitate the data migration of the three associated tables, export the data into an insert SQL sta
+ 1) AS newid, stotal, username FROM (select sum (total) stotal, username FROM exercise WHERE (username IN (SELECT username FROM ofRoster WHERE jid = CONCAT (usname, jidb) OR username = usname) AND createtime BETWEEN startday AND startday) group by username order by stotal DESC) a) a1 WHERE username = usname; insert into tmp_sportdata VALUES (totala, ranking, totalamonth, rankmonth, totaladay, rankday, usn
The stored procedure executes the select statement and the insert statement in the same table.
The stored procedure executes the select statement and the insert statement in the same ta
There are two data tables. I want to insert the data in Table A to table B.Here are my statements: 1 Insert Into Oitmyz Select * From Oitmls but the following error occurs
Tags: end col insert signed cut Sig EFI mit nbsp Dynamically copy data from one table to another table based on table data Copy the track table records to the corresponding track_ accor
Oracle Stored procedure Loop insert a table to another table 1. create a Stored procedure SQL code create or replace procedure inserttest as cursor cs is SELECT sales_id FROM t02salesinfo_backup; sales_id varchar (128 ); begin for
Generate the storage process enhanced version of the INSERT statement in batches from the data in the table,
Sometimes, we need to export all or all the data in a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.