Tags: style HTTP color using OS dataDefinition: the stored procedure (Stored Procedure) is a large Database System , a set of SQL statements to complete a particular function, compiled and stored in a database, is executed by the
determine if the database exists
If db_id (N ' DATABASENAME ') is not null
the methods for judging tables, views, stored procedures, and cursors are summarized as follows:
use databasename--jump to the specified database
go
if object_id (n ' a ', n ' U ') is not null
drop Table a
go
Note: A is a table and U represents a data table type
Type code similar to U, as
When you write a stored procedure, when you use dynamic SQL, the variable assignment is truncated when you debug.The key code is as follows:The effect of the implementation is to first the upstream and downstream to make a comparison of SQL statements and related parameters deposited Rkdm_data_void_rule,After executing
DECLARE @newsID INT
OPEN My_cursor
FETCH NEXT from My_cursor into @newsID
IF (@newsID is not NULL)
DELETE from Tb_news_type WHERE typeid= @typeID
Execute Proc_tb_news_delete @newsID = @newsID--Execute stored procedure
while (@ @FETCH_STATUS BEGIN
SET @newsID =null
FETCH NEXT from My_cursor into @newsID
IF (@newsID is not NULL)
DELETE from Tb_news_type WHERE typeid= @typeID
Execute Proc_tb_news_
If you need to regularly execute a stored procedure or SQL statements of less than 3200 characters in SQL Server, you can use management> SQL Server proxy> job.
1. Choose "manage"> "SQL Server proxy"> "job" (right-click)> "creat
Use [capitalfortune]Go/***** Object: storedprocedure [DBO]. [setmultipages] script Date: 05/30/2012 10:17:02 ******/Set ansi_nulls onGoSet quoted_identifier onGo-- ===================================================== ======-- Author: hugejile-- Alter Date: 2070-9-29-- Description: pagination. Do not change it at will.-- ===================================================== ======Alter procedure [DBO]. [setmultipages]-- Add the parameters for the
Today, at work, there is a need to look at the SQL generated in the stored procedure to check with the actual business requirements.After a multi-query, think of the following methods:1, in the stored procedure is usually involved in the execute immediate MySQL place, plus d
from dbo. GETGrade2 (' Zhang San ',' language ')Create a stored procedure, find a stored procedureCREATE PROC p_view (@userName nvarchar (ten), @subject nvarchar ( e-mail Protected] and [subject]=@subjectENDExecute the storage process' John Doe ',' mathematics 'Essentially no difference. Just a function like: Only one variable can be returned with a limit. 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 provide a self-developed general paging storage
for the DOM document.
In the following example, I pass a series of user IDs to delete multiple data columns. The following is the contents of the XML string:
2
The corresponding stored procedure looks like this:. . .
EXEC sp_xml_preparedocument @xml_id OUTPUT, @xmldata, '
DELETE from the Customer WHERE customer.tblid in (SELECT CustomerID fromOPENXML (@xmldata_id, '//customer ', 2) with (Customeridint))
.
current database.
Syntax
Sp_changeobjectowner[
@ Objname
=]'
Object
',[
@ Newowner
=]'
Owner
'
Parameters[
@ Objname
=]'
Object
'Name of the existing table, view, or stored procedure in the current database.
ObjectThe data type of is
Nvarchar (517), No default value.
ObjectCan be specified by the existing object owner, in the format
Existing_owner.
Object. [
@ Newowner
=]'
Owner
'Name of the security a
Step by step vs 2008 +. Net 3.5 (10)-add, query, update, and delete a stored procedure call using dlinq to SQL
Author: webabcd
IntroductionTaking northwind as the example database, dlinq (LINQ to SQL) calls the ADD, query, update, and delete operations of a specified stored
Createprocedure [owner.] name [; program number] [(parameter #1, hellip; parameter #1024)] [with {recompile | encryption | recompile, encryption}] [forreplication] as program line where the name of the stored procedure cannot exceed 128 words. In each stored procedure, a maximum of 1024 parameters can be set: create
Label:First, list all the databases on the server.--Get a list of databasesSELECT name from master.dbo.sysdatabases ORDER by nameSecond, this is a way for all users to create stored procedures from the database.--Get a list of stored procedures--Type = ' P '---stored procedure-Category = 0--user-createdSELECT * from sy
In my new function of using SQL Server2005 to construct a paging stored procedure, I mentioned using the Row_number () function instead of top to implement the paging stored procedure.
But the time is long, and found a new problem, is the master table paging query. For exam
the DOM document is deleted.
In the following example, I will pass a series of user IDs to delete multiple data columns. The following is the content of the XML string:
2
The corresponding Stored Procedure looks like the following:...
Exec sp_xml_preparedocument @ xml_id output, @ xmldata ,''
Delete from customer where customer. tblid in (select customerid fromOpenxml (@ xmldata_id, '// custom
Theory:
The following cmdobj. Is the defined sqlcommand object
1. Obtain the return value of the entire stored procedure function returned by the Return Statement in the stored procedure:
// Obtain the return value of the stored pr
This is a stored procedure. By executing this stored procedure, the data in the specified data table is guided into an Insert statement without CREATEPROCEDURE # usp_GenInsertSql (@ tablenameVARCHAR (256) ASBEGINDECLARE @ sqlVARCHAR (MAX) DECLARE @ sqlValuesVARCHAR (MAX) SET @ SQL
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.