Tag:stored procedure

  • Learning example of stored procedure for point acquisition and consumption

    Time:2021-12-24

    1.GM_ JF customer account points table 2. GM_ JF_ Detail customer account points consumption record 3. GM_ JF_ ACTION _ Rules integral action rule table 4.GM_ JF_ GOODS _ Rules points commodity rule table Copy codeThe code is as follows: –================== test=======================================================/*declare @StatusCode int = 1;exec sp_GM_JF_AddScore ‘admin’,’AN_JF_001_001′,1,5,0,”,@StatusCode outputprint @StatusCode*/— ===========================================================================/**Judge whether to repeatedly obtain […]

  • Asp . Net calls a stored procedure with parameters

    Time:2021-12-19

    1. Detailed explanation of background calling stored procedure with parameters Example: Note: @ analysisdate, @ process_ PTR is a stored procedure parameter IDataParameter[] iDataDi = new SqlParameter[2]; iDataDi[0] = new SqlParameter(“@AnalysisDate”, showDate); iDataDi[1] = new SqlParameter(“@Process_PTR”, ID); //Gets the different time of the selected date of the test item dtDifferTime = SqlHelper.RunProceduresByParameter(“pro_GetDifferenceTimeInfos”, iDataDi);        //Runproceduresbyparameter […]

  • Obtain the views, tables and stored procedures in all databases of users through the system database

    Time:2021-12-16

    Copy codeThe code is as follows: –Setting SQL can get the instance namesp_configure ‘xp_cmdshell’ , 1;goreconfigure;go –Get instance nameEXEC sys .xp_cmdshell ‘sqlcmd -Lc’ –Get all databasesSelect * FROM Master..SysDatabases order by Name –Get all database tablesUse yeekang — database nameselect * from sysobjects where   type = ‘U’ order by name –Gets the specified table fieldselect […]

  • SQL server stored procedure syntax explanation

    Time:2021-12-9

    Stored procedures are one or more SQL commands stored in the database as executable objects.Definitions are always abstract. A stored procedure is actually a set of SQL statements that can complete certain operations, but these statements are placed in the database (here we only talk about SQL Server). If we create stored procedures and call […]

  • SQL code sorting to determine whether functions and stored procedures exist

    Time:2021-11-16

    The following describes the code used to judge the existence of various resources under SQL. Friends in need can refer to it. I hope it can be helpful for you to learn SQL functions and databases. –Does the library exist If exists (select * from Master.. sysdatabases where name = n ‘database name’) print ‘exists’ […]

  • SQL Server paging query general stored procedure (only for paging query)

    Time:2021-10-22

    It has been used since the beginning of the project. The creator of this stored procedure (sorry, forgot his name) wrote this SQL code very well. On this basis, I adjusted the code according to my habits and mode of thinking, and only used it for paging query. /*———————————————- *procedure name : P_PageResult * author […]

  • Introduction to the use of two paging stored procedures in SQL Server

    Time:2021-10-14

    Because many written recruitment tests now let the recruiters write a paging stored procedure, some enterprises even require the candidates to realize paging in two ways. If paging has not been used in the actual project, many candidates will have certain problems. The following two paging methods are introduced. 1、 Take the student table as […]

  • SQL stored procedure details

    Time:2021-9-29

    1. Stored procedure without parameters 2. Stored procedure with input parameters 3. Stored procedure with input and output parameters 4. Stored procedure with return value Stored procedure without parameters For example, the following stored procedure returns the records of all employees in the employees table. Stored procedure code: USE TSQLFundamentals2008; GO IF OBJECT_ID(‘usp_ProcDemoNoParam’,’P’) IS NOT […]

  • Stored procedures for MSSQL transactions

    Time:2021-9-27

    In the development of hotel management system, we will create room table and room type table (room type table), as shown in the following figure: Room type table: roomtype             Room table: room   First, the relationship between the two tables: room is the slave table, roomtype is the master table, and the two […]

  • Using Oracle stored procedures under Java (detailed explanation) page 1 of 3

    Time:2021-9-26

    Any reprint, please respect the copyright. (by iihero on CSDN)1、 How to create a Java stored procedure?There are usually three ways to create Java stored procedures.1. Use Oracle SQL statement to create:e. G. use create or replace and compile java source named “< name >” asFollow the Java source program. It is required that the […]

  • Analysis of stored procedure containing transaction in SQL Server

    Time:2021-7-7

    Let’s start with a concept Database transaction refers to a series of operations executed as a single logical unit of work, either executed completely or not. Then, adding a transaction to a stored procedure can ensure that all SQL codes in the transaction are either executed completely or not executed at all. For example, a […]

  • Example of SQL Server dynamic stored procedure saving data by date

    Time:2021-7-2

    In the project, a large amount of data information is often saved to the database. If only one table is used to save the data, it is certainly not realistic. The preferred solution is to establish a dynamic table by date to save the data. Without changing the code of saving method, dynamic stored procedure […]