BEGIN TRY
......
End TRY
BEGIN CATCH
......
End CATCH.
In addition, the WITH statement, if there are other SQL statements before it, should be preceded by the end of the SQL statement with a semicolon ";". For example, in this try catch, you should
Let's take a look at how you can use it to delete duplicate records in a table:
Copy Code code as follows:
If Exists (Select * FROM Tempdb.Information_Schema.Tables Where table_name like ' #Temp% ')
Drop Table #temp
Create Table #temp
Just installed SQL Server 2005 system, the additional database is the following prompts
C:\Program Files\Microsoft SQL Server\mssql.1\mssql\data
The specified path or file could not be accessed on the server. Make sure that you have the necessary
In SQL Server, random functions have rand (), NewID (), where Rand is randomly fetched in 0 to 1, and NewID is a random uniqueidentifier unique identifier.
SELECT * from Northwind.. Orders by NEWID ()--Random sort
SELECT Top * from Northwind..
IF EXISTS (SELECT name from sysobjects WHERE name = N ' Cg_dobackupjob ' and type = ' P ') DROP PROCEDURE Cg_dobac Kupjob go CREATE PROCEDURE [cg_dobackupjob] @DataBaseName varchar (@FileHead varchar), @isFullBackup b It,-0 differential backup 1
Recently in the deployment of Azure virtual machine, has been unable to access the network database, a search data to know, azure default is not open network rules, need to manually set.
To open a TCP port for the default instance of the database
1. View the version of the database
SELECT @ @version
2. View the machine operating system parameters of the database
EXEC master.. xp_msver
3. View Database Startup Parameters
sp_configure
4. View Database Startup time
Select CONVERT (varchar,
Copy Code code as follows:
select File
select file (Excel)
"
Return
Dim Upfile_5xsoft_stream
Class Upload_5xsoft
Dim form,file,version
Private Sub Class_Initialize
Dim
Here's how to implement a Dynamic FAQ (FAQ and Answer) Web site with SQL Server.
First, create a database FAQ, where the table FAQs has a field ID (int, autoincrement, and set as the primary key), subject (VARCHAR,200), Answers (text). This table
Sometimes it may be useful to associate or analyze data from SQL Server to other departments at once, a requirement that is certainly simple for SSIS, but a lot of times it makes a fuss to create a SSIS package just by exporting the data one at a
One, Custom function:
1. Can return the table variable2. There are a lot of restrictions, includingCannot use output parameters;Cannot use temporary tables;The operation inside the function cannot affect the external environment;The result set
Brief introduction:
tempdb is SQL Server's system database, which is always an important part of SQL Server, and is used to store temporary objects. It is easy to understand that tempdb is a sketch board for SQL Server. Both the application and the
One requirement is to store multiple states in a cloud-monitored state value (including various exceptions, warning states that can exist simultaneously) using a bitwise operation mechanism to store in an int.
Now the monitoring log data is very
MS SQL Server Chinese version of the preset date datetime format is YYYY-MM-DD hh:mm:ss.mmm
Long and Short date format
Copy Code code as follows:
--Short Date format: yyyy-m-d
SELECT REPLACE (CONVERT (varchar), GETDATE (), (), N '-0
Author: FlashskySITE:WWW.XFOCUS.NETMail: flashsky@xfocus.org
In SQL SERVER 2000 communication, a well-known pipe is allowed to communicate, and is typically named:Default instance: \\.\pipe\sql\queryNamed instance:
Scene:
A recent DB server occasional CPU alarm, my email alarm threshold (Please read yù) value set is 15%, the beginning is not the case, thinking is what the statistical category of inquiries, and then more frequent.
Explore:
I decided to check
"Custom Functions" is our usual term, and "user-defined Functions" is a written version of SQL Server.
SQL Server 2000 allows users to create custom functions, and custom functions can have return values.
Custom functions are divided into:
Copy Code code as follows:
--Way One
if exists (SELECT * from dbo.sysobjects WHERE id = object_id (N ' [dbo].[ Usp_procedurewithtransaction_demo] and OBJECTPROPERTY (ID, N ' isprocedure ') = 1)
drop procedure [dbo].
Copy Code code as follows:
--begin distributed TRANSACTION [Transactionname]
--Flags a TSQL distributed transaction starting with the Distributed Transaction Coordinator MSDTC Management
--server a server as the primary control server. When
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.