SQL Server stored procedure self-initiated

Pre-Preparation:Use master;CREATE table Loginlog (LoginName nvarchar (+), Logintime datetime);CREATE PROCEDURE Sp_recordloginlog #注意没有参数的情况下不可以有 "()"AsBeginInsert into Loginlog (loginname,logintime) VALUES (System_user,getdate ());EndGo--------------

SQL Server Select Locks to add

1.Database-level shared locks to prevent others from deleting this database.2.The intent shared lock on the table to prevent others from modifying the definition of the table.3.Add intent to share the lock on the page.4.A shared lock is added to

SQL Server Import export methods that do not lose primary keys and views

SQL Server Import ExportSQL Server Import ExportTools/Materials Import and export data using Microsoft SQL Server Management Studio. Importing and exporting data directly using Microsoft SQL Server Management Studio loses primary keys,

SQL Server 2008R2 Backup to the situation network shared hard disk

First, if xp_cmdshell is not enabled, perform the following enable:EXEC ' Show advanced Options ' 1 ; RECONFIGURE; EXEC ' xp_cmdshell ' 1 ; RECONFIGURE;1. Create a map:exec ' net use \\192.168.9.140\Share 123456/user:192.168.9.140\administrator '2.

SQL Server full-text indexing

-----------------------------Full-text indexing using a small sample------Use SQL2000 and SQL2005 respectively------------------------Usage Scenarios: Complex query text data stored in data columns--EnvironmentUse PooflyGoCREATE TABLE HELLO (ID INT

Random range processing method for SQL Server random numbers

Recently in the database on the random number, really touch I want to die heart all have, before all through the rand () function of PHP to deal with a range of random numbers, but recently in the processing of large amounts of data processing

SQL Server grouping with RowNumber

1 SELECTRECORD.[record_id]2, RECORD.[workflow_info_id]3, RECORD.[Form_code]4, RECORD.[apply_date]5, RECORD.[apply_emp_id]6, RECORD.[Apply_emp_number]7, RECORD.[apply_emp_name_en]8, RECORD.[APPLY_EMP_NAME_CN]9, RECORD.[Apply_emp_email]Ten,

SQL Server role those things

Fixed server role DescriptionThe sysadmin can perform any activity in SQL Server.ServerAdmin can set server-wide configuration options to shut down the server.Setupadmin can manage linked servers and startup processes.Securityadmin can manage logins

SQL Server finds the statements that deserve optimization

Method 1,Sys.dm_exec_qurey_stats returns aggregate performance statistics for cached query plans in SQL Server. each query statement in the cache plan corresponds to a row in that view .                                   &N Bsp             and the

SQL server-Execution Plan

1. each execution of the SQL statement generates an execution plan and is cached because the execution plan is generated with time overhead, so reusing the execution plan can improve performance and save buffer space. We can use

SQL Server 2005 Table master: Spt_values

IF object_id (' tempdb.. #t ') is not a NULL DROP TABLE #tGOCREATE table #t (ID int identity,dt varchar (10))GoDECLARE @starttime datetime, @endtime datetimeSet @starttime = ' 2010-5-01 'Set @endtime = ' 2010-5-31 'Select number from Master.

SQL Server indexes and views

BusinessPrimary key:Index:Lock:=========================================A page is divided intoPage HeaderPage body--store rowEnd of pageThe page has a fixed size, but the data is not necessarily full, it is possible to fragment, that is, row-by-page=

SQL SERVER Multi-table operations internal connections, outer joins

MSSQL database is divided into natural connection, inner connection, outer connection1, natural connection and inner connection are basically the same. The difference is that the natural connection "=" on both sides of the column property values

SQL Server Row version control

When does the line version start?When we find that there are a lot of read/write blocking in the system, it is time to turn on the line version. Important: Write blocking scenario line version technology can not solveOpen mode:--set to single user

SQL Server restores those things

Because the things that I want to summarize are messy, it's a problem.1. When restoring a database, no tail-log backup is selected, an exception occurs:This is because for databases that use the full recovery model or the bulk-logged recovery model,

SQL Server DBCC SHRINKFILE does not work

Method 1, rebuild the clustered index.Method 2, rebuild the heap table.--------------------------------------------------------------------------------------------------------------- --------------------------------------------------Principle

SQL Server 2000 "user xx already Exists" processing method

-- currently encountering this problem occurs when the server is switched on. The old server backed up database is restored to the new server, and you will encounter this problem -The following scenario:- - Find the orphaned user list EXECUTE'

SQL Server 2008 RESTORE Database

1. Get the database backup file, how to get, [can see here]~2. Add a. bak suffix to the backup file, for example:3. Open SQL, you can create a new empty database, or use the original database, right-click >> Tasks >> Restore >> Database4. The

SQL Server files automatically grow those things

Method 1,Set the file growth to a fixed size. such as FileGrowth = 100MB;--------------------------------------------------------------------------------------------------------------- -------------------------------------------Data file growth

SQL Server aggregates historical backup information to compare database growth, SQL Server

SQL Server aggregates historical backup information to compare database growth, SQL Server Most of the time, when we plan the space for the SQL Server database or ask for storage space, we need to estimate the size of the database space to be

Total Pages: 923 1 .... 823 824 825 826 827 .... 923 Go to: GO

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.