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.
Server| stored Procedure--I refer to the table name my fruit some fields [5] to refer to some of the fields [3] in the following table [1]
DECLARE @id bigint
Select @id =id from sysobjects where name= ' d_ patient database '
Select
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 keywords or space-based field names, while ignoring self-growth field data.
CREATE Procedure
The SQL Server Stored Procedure encountered the error "Table'' # TT ''cannot perform the SET operation without the identity attribute,
An error is reported when a temporary table is created and data is inserted into the temporary table.
The system prompts that the primar
The MySql stored procedure dynamically creates a table and inserts data to a recently created Project. The database uses MySql, which is not very skillful in MySql, but can be simply used, after all, simple SQL statements are still the same, but as the project goes deeper into complicated SQL statements, MySql stored p
BEGIN
drop_table(‘y_test‘);
EXECUTE IMMEDIATE ‘ create table y_test (id number, name varchar2(20)) ‘;
FOR i IN (SELECT/*+driving_site(b) */ * FROM small_tab_local a, [emailprotected] b
WHERE a.sub_id=b.sub_id AND a.acc_id=b.acc_id)
LOOP
INSERT INTO y_test VALUES i;
END LOOP;
COMMIT;
END;
a solution has been thought of,
DDL statements cannot be used directly in Oracle's stored procedures, such as CREATE, alter, DROP, truncate, and so on.That assumes that we want to create a temporary table in a stored procedure that can only use dynamic SQL statements:Create or replace procedure Pro as str
On the Internet, we can see that many people use links to delete recursive tables. But in sqlserver2005, I say that I am in violation of the constraints and depressed, so I want to use recursion. Here is a recursive table.
Create Table [DBO]. [Tiku] (
[Tikuid] [int] identity (1, 1) not null,
[Tikuname] [varchar] (50) Collate chinese_prc_ci_as not null,
[Tikuparentid] [int] not null,
Constraint [pk_tiku] pri
Delimiter//create procedure OneKey (in NewName varchar (+), in oldname varchar (+), in Idnum INT) beginset @sqlStmt = CONCA T (' insert INTO ', NewName, ' (' Name ', ' age ', ' sex ', ' major ', ' Pass ', ' photo ') Select ' name ', ' age ', ' sex ', ' major ', ' Pass ', ' Photo ' from ', Oldname, ' where id = ', idnum); PREPARE stmt from @sqlStmt; executestmt; End;//delimiter; call OneKey (' stu1 ', ' Stud
In Oracle, compare the data in a table with the input parameters and perform corresponding operations (stored procedures). If table a contains y records greater than x, insert y A words to Table.
In Oracle, compare the data in a table with the input parameters and perform c
CREATE OR REPLACE PROCEDURE pubres_testAsBEGINFor obj in (Select Resource_name,unit_name,resource_code,sum (update_count) update_countFrom Winf_pubres_update_logGroup BY Resource_name,unit_name,resource_code)Loop--Statistical summaryInsert into Winf_pubres_allupdate_log (unit_name,resource_name,resource_code,update_count,update_date)VALUES (Obj.unit_name,obj.resource_name,obj.resource_code,to_char (obj.upda
A newly written SQL code is used in the stored procedure to split input strings and insert them into the table:
I don't know if the efficiency is high? (Please advise)
Declare @ SQL nvarchar (4000)Set @ SQL = Replace (@ Vote, '|', 'Union all select ')Set @ SQL = 'select' +
Tags: mysql stored proceduresImplement a simple move table, using a cursor loopThe first line DELIMITER//and the last line//must, or encounter a semicolon to errordelimiter//createproceduremovedata () BEGIN DECLARE
doneintdefault0;
declarev_idvarchar (30); /* declaring cursors */declarers
CURSORFORSELECTidFROM ' new ' customer; /* Exception Handling */DECLARE
continuehandlerforsqlstate ' 02000 ' SETDone=1;
Query Creation Time
-- TableSelect * From sysobjects where id = object_id (n'table name') and xtype = 'U'-- Table structureSelect * From syscolumns where id = object_id (N 'table name ')-- Stored ProcedureSelect * From sysobjects where id = object_id (n'stored procedure name') and xtype = 'P'
Query the last modifica
This article does not place the stored procedure instance.This is the most time-consuming problem I have encountered in developing a stored procedure, and the stored procedure can run, but the result is not what you want,For a lon
' exists 'EndElseBeginprint ' does not exist 'End-----------------Determine if the stored procedure name to be created existsif exists (SELECT * from dbo.sysobjects WHERE id = object_id (N ' [dbo].[ Stored procedure name] ') and OBJECTPROPERTY (ID, N ' isprocedure ') = 1)--
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.