A SQL Server cursor usesThe use of the/*** cursor speaks to the advantages of this multi-cursor, and now we are personally unveiling the mysterious veil of the cursor. The order in which cursors are used: reputation cursors, open cursors, read data,
With cursors, and while you can traverse each record in your query and pass the required fields to the variable for handling accordingly
==================
DECLARE
@A1 VARCHAR (a),
@A2 VARCHAR (a),
@A3 INT
DECLARE CURSOR youcurname for
/*Principle: The cursor is to extract data according to the specified requirements of the corresponding data set, and then data processing.1.1 The concept of cursorsCursor It enables the user to access the result set returned by SQL Server on a
Recently, a business website launched by the company was attacked by hackers. through SQL injection, the trojan was injected into the database, and the whole MSSQLSERVER data was appended with malicious scripts.
Recently, a business website launched
Share an SQLSERVER script (calculate the data volume of each table in the database and the space occupied by each row of Records) in many cases, we need to calculate the data volume of each table in the database and the space occupied by each record.
Editor: Like our server, we usually use tools to program logs by 1 MB. If you are not bothered, see the manual method: 1: Delete LOG1: detach Database Enterprise Manager-server-database-right-click-Detach database 2: delete LOG file 3: attach
SqlServer backs up multiple databases in batches and deletes the backups three days ago.
If you don't talk much about it, paste the Code directly. The specific code is as follows:
/*************************************** ************************* * *
For more information about SQLServerErrorLog, see.
For more information about SQL Server ErrorLog, see.
By default, SQL Server saves seven ErrorLog files named:
ErrorLog
ErrorLog.1
ErrorLog.2
ErrorLog.3
ErrorLog.4
ErrorLog.5
ErrorLog.6
In apacs OS 6
Cursor Concept
In database operations, we often encounter this situation, that is, reading a record one by one from a specific result set. How can this problem be solved? Cursors provide us with an excellent solution.
Cursor is a data buffer
The cursor concept database operation often encounters this situation, that is, reading a record one by one from a result set. How can this problem be solved? Cursors provide us with an excellent solution. Cursor is a data buffer provided by the
Recent projects need to look at the size of the data user table, including the number of record bars and the number of disk space occupied. On the internet for a long time it is possible to view the size of each table in the MSSQL database relative
Simple command:
Backup:
Backup database test to disk = 'd: \ 04-08-07bak.bak'
Restore: Restore database test from disk = 'd: \ 04-08-07bak.bak 'with norecovery
Database Backup/recovery using SQL
It embodies four knowledge points in SQL
@ Fetch_status
@ Fetch_status is a global variable of MSSQL.
The return value has the following three meanings: [return type Integer]
-0 fetch statement succeeded
-1 The fetch statement fails or this row is not in the result set.
-2 The
DECLARE my_cursor1 Cursor--Define cursor for (SELECT RowGuid, projectrowguid from [bimpm_base].[ DBO]. [Projectpermission_role] where subsystemrowguid = ' a9318399-66fe-423e-93f5-ccd7c0a471c4 ')--finds the desired set to be placed in the cursor
I hope to make a comprehensive summary of my recent work needs.SQL ServerPrecautions for database performance optimization: I searched the internet and found manyArticleSome of them list hundreds of entries, but you can see that there are a lot of
When executing the database creation script, the original database is often dropped first. Because sqlserver does not allow the execution of the drop database operation when detecting a data connection, the database creation script often fails to be
Store common or complex tasks in advance with SQL statements and a specified name, to enable the database to provide services with the same functions as the predefined stored procedure, you only need to call execute to automatically complete the
Using T-SQL statement to realize the function of database backup and Restoration
It embodies four knowledge points in SQL Server:
1. Obtain the default directory on the SQL Server
2. Use of backup SQL statements
3. Restore the use of SQL statements,
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.