MSSQL Server EXEC and sp_executesql
, Exec's use
The use of 2,sp_executesql
MSSQL provides us with two commands for dynamically executing SQL statements, namely, EXEC and
Sp_executesql Usually, sp_executesql is more advantageous, it provides the
SQL Server Objectsencryption Method: Add "with Encryption" before the "as" position in the stored procedure, function, and "with encryption" in front of the "for" position, if it is a trigger. Decryption process: 1. Execute the following
For example, all of the following are examples of studnet tables:Calculating string LengthsLen () is used to calculate the length of a stringSelect Sname, Len (sname) from studentConvert string to large, lowercaseLower () is used to convert a string
The usual functions in SQL drip 30-sqlThis article is reproduced from http://www.cnblogs.com/jiajiayuan/archive/2011/06/16/2082488.htmlOther people's summary, very detailed.For example, all of the following are examples of studnet tables:Calculating
Text: string manipulation in SQL Drip 33-sqlCalculating string LengthsLen () is used to calculate the length of a stringSelect sname,len from studentConvert string to large, lowercaseLower () is used to convert a string to lowercase, and upper () is
There are many systems in the enterprise is traditional, due to various reasons, the company is currently in the implementation of the simplified, but the system also has the exchange of data, so the system can only one change, in case there are too
I. What is covered in this article (Contents)
What is covered in this article (Contents)
Background (contexts)
Implementation code (SQL Codes)
Method One: Use splicing SQL, static column field;
Method two: Using
I. What is covered in this article (Contents)
What is covered in this article (Contents)
Background (contexts)
Implementation code (SQL Codes)
Method One: Use splicing SQL, static column field;
Method two: Using
I. Requirements
Because of poor expression ability, direct. In the mssql environment, you need to convert the table in figure 1 to the table in Figure 2:
Figure 1 Figure 2
Ii. Analysis
Figure 3
2.1 create a table Copy codeThe Code is as follows:
The use of MSSQL by sp_executesql provides two types of commands for dynamic execution of SQL statements: EXEC and sp_executesql. Generally, sp_executesql is more advantageous and provides an input/output interface, EXEC does not. Another major
Recently, due to disk space problems, when performing routine maintenance such as defragmentation and so on will report insufficient disk space warning, due to conditions and unable to add disk space in a timely manner, when the log file must be
/**/ASCII (charactor_expression)--Returns the ASCII value of the leftmost character of the string. Select ASCII ('bcd ')Char (integer_expression)-- Convert int ASCIICodeConvert to character Select char (97)Nchar (integer_expression) -- Return with
View all stored procedures and functionsExec sp_stored_procedures -- or select * from dbo. sysobjects where OBJECTPROPERTY (id, N 'isprocedure ') = 1 order by name
View Stored Procedure contentSelect text from syscomments where id = object_id
SQL Server Functions
-- Aggregate functionsUse pubsGoSelect AVG (distinct price) -- calculate the averageFrom titlesWhere type = 'business'
Use pubsGoSelect max (ytd_sales) -- maximum numberFrom titles
Use pubsGoSelect min (ytd_sales) -- Minimum
I. Requirements
Because of poor expression ability, direct. In the mssql environment, you need to convert the table in figure 1 to the table in Figure 2:
Figure 1 Figure 2
Ii. Analysis
Figure 3
2.1 create a table
Copy codeThe Code is as
Start:
--------------------------------------------------------------------------------
On the network, we can see how SQL Server 2000 and SQL Server 2005 encrypt and decrypt stored procedures. Later, we analyzed the code and found that they work in
Function used by SQL Server to retrieve the year, month, and day of a dateConvert (varchar (10), getdate (), 120)
You can adjust the number of intercepted varchar (10) and display up to 19 (varchar (19) bits )).----------------------------------
Start:
--------------------------------------------------------------------------------
On the network, you see the methods of encrypting and decrypting SQL Server 2000 and SQL Server 2005 stored procedures, and then you analyze the code and find
I. Demand
Because the ability to express is not good, directly above the picture. In the MSSQL environment, you need to convert the table in Figure 1 to the table in Figure 2:
Figure 1 Figure 2
Second, analysis
Figure 3
2.1 Creating a table
Http://www.cnblogs.com/jiajiayuan/archive/2011/06/16/2082488.htmlFor example, all of the following are examples of studnet tables:Calculating string LengthsLen () is used to calculate the length of a stringSelect Sname, Len (sname) from
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.