SqlCommand or SqlDataAdapter object → ExecuteNonQuery () for SQL commands or stored procedures () method or ExecuteReader () method to perform data operations → read or input data to the database → Close the connection using the Close () method.
We can see that before using stored procedures, we should use the SqlCommand object or SqlDataAdapter object to fill t
Copy Code code as follows:
SET ANSI_NULLS on
Go
SET QUOTED_IDENTIFIER ON
Go
CREATE PROCEDURE [dbo]. [Pagination]
@Page int = 1,--current page number
@PageSize int = 10--Number of record bars per page (page size)
@Table nvarchar (500)--table name or view name, or even nested sql: (Select * from Tab Where id>1000) tab
@Field nvarchar (800) = ' * ',--Returns the recordset field name, "," is sepa
Tags: ROM parameter close type process lin default Create Tun--Stored procedure (without parameters) Create or Replace procedure stored procedure nameAsvariable, constant declaration;BeginCodeEnd --Stored
The following articles mainly introduce the correct operation steps for connecting SQL Server to the DB2 Server. In practice, the interconnection between different database platforms is generally referred to as the heterogeneous database service, currently, all major databases can achieve such Heterogeneous Interconnection, but the specific implementation technologies of different vendors are different.
For
a view
DROP VIEW [dbo].[View name]
GO
---------------
--determine if the name of the function to be created exists
IF exists(SELECT * fromDbo.sysobjectsWHEREId= object_id(N'[dbo]. [function name]') andXtypeinch(N'FN'N'IF'N'TF'))
--Delete a function
DROP FUNCTION [dbo].[Name of function]
GO
IF col_length('Table name','Column Name') is NULL
PRINT 'does not exist'
SELECT 1 fromsysobjectsWHEREIdinch(SELECTId fromsyscolumnsWHEREName='Column Name') andName='Table name' Reprint: http://www.bitscn.c
Instance 1: only the stored procedure of a single record set is returned. The content of the bank deposit table (bankMoney) is as follows: IduserIDSexMoney001Zhangsan male 30002Wangwu male 50003Zhangsan male 40 requirement 1: createproceduresp_query_bankMoneyasselect * fromba
Instance 1: only the stored procedure of a
// open the cursor fetch next from city_cursor into @ field // assign the actual ID to the variable while (@ fetch_status = 0) // The loop starts begin if @ result = ''select @ result = convert (nvarchar (2), count (*)) from ajaxcounty where cityid = @ field else select @ result = @ result + ',' + convert (nvarchar (2), count (*)) from ajaxcounty where cityid = @ field fetch next from city_cursor into @ field // next cityid end close city_cursor // close the cursor deallocate city_cursor // rel
If a stored procedure is modified during project development, how can I quickly find other stored procedures using the stored procedure?
If a stored procedure is modified during projec
Copy CodeThe code is as follows:
SET ANSI_NULLS on
Go
SET QUOTED_IDENTIFIER ON
Go
CREATE PROCEDURE [dbo]. [Pagination]
@Page int = 1,--current page number
@PageSize int = 10--Number of record bars per page (page size)
@Table nvarchar (500)--table name or view name, or even nested sql: (Select * from Tab Where id>1000) tab
@Field nvarchar (800) = ' * ',--Returns the recordset field name, "," is separated by
I will not talk about the concept of the stored procedure, because the search engine is more detailed and wonderful than me. I will only give an example to do more practical things.
First, create a database sample and then use the following statement to create a table. Of course, you 'd better insert some data in the table. If you don't want it, you can. Call the added
Author: liigo
Date: 2010/8/25
Original: http://blog.csdn.net/liigo/archive/2010/08/24/5834450.aspx
Reprinted please indicate the source: http://blog.csdn.net/liigo
Microsoft SQL Server database stored procedures, according to their input and output data, can be divided into the following general situations or their combination: no input, one or more input parameters, no output, return a value directly. One
For example, the stored procedure to invoke is GXTJ (A, B)
$db =new mysqli ("localhost", "ssss", "AAAAA", "bbbb");
Mysqli_query ($db, "SET NAMES UTF8");
$result = $db->query ("Call GXTJ ($year, $JD)"); GXTJ is the name of the stored procedure for MySQL [Color=gray][/color]
while ($row = $result-
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] Varchar( -), TenNameVarchar( -), OneTypeVarc
Tags: des style blog io color ar sp div onC # calls SQL with an output parameter in the stored procedure, and the type is a character type when you must specify the length of the parameter. Otherwise the obtained result is always only the first character. I was for this reason, tossing for a long time. In this record, for everyone to reference later!For example:C
Tags: syntax server side nvarchar No name pre list tle addA stored procedure (stored procedure) is a set of SQL statements designed to accomplish a particular function, compiled and stored in a server-side database, which can be u
I would like to explain the stored procedure in the following aspects. Some knowledge points may not be worth your attention, or I may not know some knowledge points. Thank you for your advice. If you have any questions, please feel free to advise!
Stored Procedure Concept
Advantages of
Stored Procedure application for SQL Server database development (reproduced)
Author: cultivator
CollationSome may have been using SQL Server for development for some time, but they have not or seldom used stored procedures in projects. Some may think that there is no need
From http://c21.cnblogs.com/archive/2006/05/08/393779.htmlConcept of Stored Procedure
SQL Server provides a method to centralize some fixed operations by the SQL Server database Server to implement a task. This method is a stored procedu
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.