Alibabacloud.com offers a wide variety of articles about select stored procedure into temp table, easily find your select stored procedure into temp table information here online.
Sort the records for future reference. I tested SQL Server 2005 Express.
Source: http://www.itpub.net/thread-1438927-1-1.html
Other Reference Links: http://www.cnblogs.com/footleg/archive/2008/09/09/1287327.htmlUse OpenRowSet
Sp_configure 'show advanced options', 1GoReconfigureGoSp_configure 'ad hoc distributed queries ', 1GoReconfigure
Go
Select *Into mytable -- (can be either a temp
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_ according to the mac_id two digits. In the table such as: mac_id=12345678910, the latter two-bi
Insert | stored procedure
I've found two stored procedures that automatically generate a stored procedure for inserting and updating a datasheet, now dedicated to everyone!
Insert:
Create procedure Sp_geninsert
@TableName varcha
SQL Server traverses the database file to find all stored procedures that use a table/stored procedure.1 CREATE ProcedureSp_getproc2 @Object_Name Varchar( -) 3 as 4 SetNocount on 5 6 DECLARE @tmptable TABLE 7 ( 8Idint IDENTITY(1,1), 9 [DataBase] Va
names.Select Count (*) AS Qty FROM MSysObjects Where (MSysObjects. Name) Like 'table name ');
Copy codeThe Code is as follows: whether the library exists
If exists (select * from master .. sysdatabases where name = N 'database name ')
Print 'exists'
Else
Print 'not exists'
---------------
-- Determine whether the table name to be created exists
If exists (
I often write a stored procedure and use select to return a dataset. Today, in the stored procedure, I need to judge that the value of a field cannot be repeated in a table. This field is not a primary key, I used
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 table in a
A.TargetPeriod like '%123%' and E.OrgCode like '%123%'order by A.TargetPeriod desc,C.SalesName,D.CatalogName
The preceding SQL statement contains some special cases, such as the Convert function, no primary key, multi-table join, table alias, and field alias. These cases may be tricky to handle, of course, the "'' as CheckBox "is a special case in my system and is used for some processing.
I am here to pro
If the content is not good, please forgive me
To meet project requirements, we need to create temporary tables and temporary functions in a stored procedure to merge the return tables of N tables in a stored procedure. This creates a lot of trouble, now we have finally finished it.
Let's take a look at the final code.
Determines whether a table (temporary table) exists and whether a stored procedure exists.1. Determine whether a formal table or stored procedure has a
fromChinadba1whereUserid= 4Print @addr --keep the original valueGoIt is important to note that SELECT can also assign the value of the scalar subquery to a variable, and if the scalar subquery does not return a value, the variable is set to a null value.This is exactly the same as using SET assignmentThe concept of scalar quantum query everyone should be unfamiliar, for example, can explainDeclare @addr varchar( -)Set @addr = 'Initial value'--
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
Tag: Transaction does not have plain key test statement to_date error RACFirst, according to this article: http://www.cnblogs.com/coolzdp/p/7717332.html We know that in the SELECT * stored ProcedureINTO 如果没有记录是不会往下执行的,直接抛出NO_DATA_FOUND异常, This in plsql Developer Direct Test Execution No problem , will be reported ORA-1403 exception. But it is not thrown when called in MyBatis.NO_DATA_FOUND异常,而是在
Code: delimiterDROPPROCEDUREIFEXISTSM_DNAMECREATEPROCEDUREM_DNAME (MONTHVARCHAR (2) SELECTINCOME. CID, COUNT (*) COUNTSFROMINCOMEWHERETIMELIKE #39; ______ MONTH % #39; delimiter; how is the MONTH variable inserted in like above? Select statement for mysqllike stored procedure
Code:Delimiter //
Drop procedure
,a.danweiname,'Geneva', Note - fromPx_inportscore a + JoinPk_user b onA.identitynum=B.identitynum A whereB.rowguid not inch(SelectUserguid fromPx_baom) at - - ) - - Insert intoPx_baomdetail (rowguid,itemguid,itemname,isdel,classguid,parentguid,isconfirm) -(--INSERT into the Registration sub-table condition: Insert the person successfully into the registration form and these people are not in the paren
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.