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,
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> -- Method 1 If Exists ( Select * From DBO. sysobjects Where ID = Object_id (N ' [DBO].
If exists (select * From DBO. sysobjects where id = object_id (n' [DBO]. [checkandratify_stat] ') and objectproperty (ID, n' isprocedure') = 1)Drop procedure [DBO]. [checkandratify_stat]Go
Set quoted_identifier onGoSet ansi_nulls onGo
Create
If your program is just a single-line, single-process program, you usually only need to pay attention to the correctness of the program, your program can normally provide the desired functions, but when your program is a multi-line program and
-- 1. sqlserver database dictionary -- table structure. SQL
Select Top 100 percent -- A. ID,
Case when a. colorder = 1 then D. Name else ''end as table name,
Case when a. colorder = 1 then isnull (F. Value, '') else'' end as table description,
A.
Database Backup/recovery using SQL
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, and disable the processing of other user
1. Add a field
Copy codeThe Code is as follows: if not exists (SELECT * from syscolumns where id = OBJECT_ID ('querydatasource ') and name = 'iscrosstable ')
BEGIN
Alter table QueryDataSource ADD IsCrossTable bit default (0) -- insert Field
END
2
The following are common SQL statements used by SQL Server and access to operate database structures.
Create a table:Create Table [Table name]([Automatic number field] int identity (1, 1) primary key,[Field 1] nvarchar (50) Default \ 'default
C # Connecting to SQL Server databases For the different. NET data provider, ADO. NET uses different connection objects to connect to the database. These connection objects mask the specific implementation details, and provide a unified
Prior to the thread understanding is not deep, so the thread mechanism of QT is not clear, write an article today to summarize, if there are errors, welcome to point out.First you need to understand what the thread is, the thread in the code is
Using T-SQL statement to realize the function of database backup and restore
Embodies four of the knowledge points in SQL Server:
1. Get the default directory on the SQL Server server
2. Use of Backup SQL statements
3. Restore the use of SQL
There are too many files in the machine, so it needs to be sorted out.
This article to organize the picture file for example, give us a little thought
Code's operating environment: Iis5.0+sql server2000
Database scripts:
if exists (SELECT * from
/*Navicat MySQL Data TransferSource server:206 Docker MySQL 13306Source Server version:50720Source host:192.168.7.206:13306Source Database:kafkamonitorTarget Server Type:mysqlTarget Server version:50720File encoding:65001Date:2018-05-05
In the LINQ to SQL Advanced Series (i), we talked about two basic relationships 1:m and 1:1 in a database. And in the real world, there is a m:m relationship. For example, a teacher can have more than one student, and a student can have multiple
--whether the library existsif exists (select * from Master.. sysdatabases where Name=n ')print ' exists 'Elseprint ' NOT EXISTS '--Determine if the name of the table to be created exists, delete itif exists (SELECT * from dbo.sysobjects WHERE id =
--Delete primary keyALTER TABLE name drop constraint primary Key name--Add primary keyALTER TABLE name add constraint primary Key name primary key (field name 1, field Name 2 ...)--Add a primary key for a nonclustered indexALTER TABLE name add
SQL Server System table sysobjects describes and usesAll information about the SQL Server database is stored in its system table. I wonder if you have spent more time checking the system tables because you are always busy with user forms. However,
--Delete primary keyALTER TABLE name drop constraint primary Key name--Add primary keyALTER TABLE name add constraint primary Key name primary key (field name 1, field Name 2 ...)--Add a primary key for a nonclustered indexALTER TABLE name add
Below you introduce SQL under the use of a variety of resources to determine the existence of the code, the need for friends can refer to, I hope you learn SQL functions and databases can be helpful.Whether the library existsif exists (select * 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.