Objective
In this section, we continue our trip to SQL, this section of the title to say some basic knowledge and need to pay attention to the place, if there is something wrong, but also hope that the short content, in-depth understanding.
First, the preface
Now do project data access will basically choose an ORM framework, it in object-oriented form to screen the underlying data access form, so that developers more focused on business processing, rather than the interaction with
SQL Server 2005 does not allow remote connections by default, and to enable MSSQL through remote connections, database backups require the following settings:
Steps/Methods1. Open SQL Server Configuration Manager, log on using Windows identity2.
A computer in the morning, black screen run some code to repair the system .... SQL Server is not connected after entering the system
Body
reason:SQL Server's services are automatically shut down and startup failed
Windows log information: The
Although the small edit does not recommend that you use the command to delete the contents of the database table, but these delete commands are always useful places.
When it comes to deleting a table's data, the most important thing you can
1, automatically add fields need to be rewritten. AutoNumber fields that are often used in access. After import to MSSQL, he is not a self-added int, need to manually set, the number of the imported AutoNumber field is changed to "yes", "seed" and
Sometimes we want to access data on another SQL Server database under one SQL Server, or access data on other Oracle databases, and to do so, we first create a database link.
A database link enables a local SQL Server logged-on user to map to a
One, overview of the index
1, Concept: A database index is a structure that sorts the values of one or more columns in a datasheet, like a book's TOC, which provides the ability to quickly query specific rows in a row.
2, advantages and
Accident causes:
Prior to using SQL SERVER2008+VS2010 development, after installing VS2012 database suddenly unable to connect
Discovery SQL Server Configuration Manager shows remote procedure debugging failure
Reasons & Countermeasures:
Local
1. Convert time to String form:
Copy Code code as follows:
CONVERT (varchar, field name,)--------yyyy-mm-ddhh:ss:mm0000
Convert (char (10), field name, YYYY-MM-DD)------
2, if you are using the SQL editor (Microsoft's own
1. You can assign values directly when you define a variable
DECLARE @Id int = 5
A 2.Insert statement inserts multiple rows of data at a time
INSERT into StateList VALUES (@Id, ' WA '), (@Id + 1, ' FL '), (@Id + 2, ' NY ')
3. Support + +
1. Pass to database statement parameters
Passing parameters to a database operation statement can be implemented by a stored procedure, and here are two other easy ways to do this:
You can pass parameters directly into a SQL statement variable in C #
In your current job, you need to address the issue of replicating the entire SQL Server database, which includes the database outline, stored procedures in the database, functions, table structure, primary foreign key relationships, and all the data
Create a Mybackup.bat, enter the following to run the script directly, you can start to automatically back up the database or the script to join the Windows task plan to execute.
@echo off
set path=%path%; C:Program Files\Microsoft SQL
Sp_change_users_login
Changes the relationship between SQL Server users and Microsoft®sql Server™ logins in the current database.
Grammar
sp_change_users_login [ @Action = ] 'action'[ , [ @UserNamePattern = ] 'user' ][ , [ @login Name = ] 'login'
Tools,database Maintenance Planner in Enterprise Manager, you can set up a regular automatic backup schedule for the database. and run the backup schedule by starting the SQL Server Agent. The specific steps are as follows:
1, open Enterprise
I used to use SQL Server2000, and now it's so tight with the trend, and I need to use SQL Server2005 to use it in my current project. For SQL Server 2005, there are several places to pay attention to, for example, when restoring a database, unlike 20
Copy Code code as follows:
Select actions: backup
recovery
database name: " >
file path: (file path for backup or recovery)
' Backup and restore of SQL Server database!
If Request ("action") = "BackupDatabase" Then
Dim
Recently, colleagues need to query the user's business and report data from several tables, write a SQL statement, the query is slow:
Select
s.name,
S.accountantcode,
(
Select COUNT (*) from (
select Distinct businessbackupid from
Temporary table generation: A:select into and b:create table + INSERT into
1. A is much faster than B. But a locks up the sysobjects, sysindexes, and syscolumns tables in tempdb, which can easily clog up other processes when multiuser concurrency
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.