Add reference firstUsing system. Data;Using system. Data. sqldata;
String conn_str = "Data Source = Name or IP address of the machine where the database is located; initial catalog = Name of the connected database; user id = user name for
In SQL Server 2005, Microsoft released a report that can be viewed directly. However, this report cannot be used in SQL Server 2000.
So I wrote the following sentence to return the same result.
Create Table TMP (name varchar (50), rows int,
// The index key of the datasource instance bound to the servletcontext. If this parameter is not set, the default value is action. data_source_key,
// If the applicationProgramIf there is more than one datasource, you must set the key value.
Many developers often do not consider the char and varchar types when designing databases. Some developers do not pay attention to them because the storage price is getting cheaper and cheaper, I forgot some of the basic design theories and
CPU:1. System: % Total processor time average CPU usage (you can also treat a program such as sqlserver process % processor time)2. System: % processor queue length number of threads waiting for processing by the processor (the normal range is 1 ~ 3
The default port of SQL Server is 1433. We can use "server network trial tool" and "client utility"
To set, the setting method is:
Use "server network trial tool" and "client utility" respectively"Set the default port in "general options"->
How to obtain field descriptions from SQL Server
SQL Server 2000
You can add a field description in the Enterprise Manager or use the following code: exec sp_addextendedproperty'Ms _ description ','Some description ','User ',DBO,'Table ',Table_name,
SQL Server transaction Overview (1)
Transaction attributes
Transactions have ACID properties, I .e. atomic atomicity, consistent consistency, isolated isolation, durable permanent
Atomicity
That is, the transaction should be taken as a unit of
In the software development process, we often encounter database promotion problems for many reasons, such as acsess access speed ratio.SQLServer slow, after deleting data recordsAccessWill leave a blank file, the file is getting bigger and bigger
A stored procedure is used to generate a unique ID and ensure the uniqueness of the ID number in the case of concurrency.
It can be used in the database system to obtain the globally unique sequence number.
Run the following code for SQL Server 200
Let's just start with an example.
Open SQL Server to create a table:
Create Database testdb
Go
Create Table Test(Name1 varchar (10 ),
Name2 nvarchar (10))
Go
Insert into test values ('february 5 ', 'february 5, 80 or 90')-success
Insert into test
1. Create two tables Table1 and Table2. The table structure is as follows:
coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> alt="说明: C:/Documents and
SQL Server date format conversion (convert usage
In SQL Server, convert can convert a date to a different format. The format control is completed by the style in convert (data_type [(length)], expression [, style. The following lists the
-- Supports 20000 Chinese characters in a large character set!
Create Function f_ch2py (@ CHN nchar (1 ))
Returns char (1)
As
Begin
Declare @ n int
Declare @ C char (1)
Set @ n = 63
Select @ n = @ n + 1,
@ C = case CHN when @ CHN then Char (@ n)
To read and write a word file in SQL Server, you must add an image column to the table to be accessed. The structure of the example table is as follows:
CREATE TABLE CONTRACTS ( ID VARCHAR (50), CONTRACT_FILE IMAGE);
To store the Word file in
5. After calling the stored procedure using the sqlservercallablestatement class, you can call the stored procedure using any of the execute or executeupdate methods. The executeupdate method returns an int value that contains the number of rows
1. To optimize the query, try to avoid full table scanning. First, consider creating an index on the columns involved in where and order.
2. Avoid using left join and null values as much as possible. Left join consumes more resources than inner join
The memory of SQL Server increases constantly.
When the SQL Server database engine runs on Microsoft & reg; Windows NT & reg; or Windows & reg; 2000, its default memory management behavior does not obtain a specific amount of memory, instead,
The SQL Server Memory has two basic management methods: Dynamic Allocation and static allocation.
The amount of memory that can be used by the control program. Dynamic Allocation allows the Administrator to declare the size of a piece of memory.
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.