We will summarize several main cases:
I. How to enter a null valueIf you do not enter a null value, if the time is null, "" is written by default, which is troublesome for business processing.
CTRL + 0 to enter a null value.
Ii. How to judge
In SQL Server, the following is the connection:
The SQL Server timestamp data type is independent of the time and date. SQL Server timestamp is a binary number that indicates the relative sequence of data modifications in the database. The timestamp
Under normal circumstances, the SQL Server server will create an appropriate index for a frequently used tableThis will greatly improve the data retrieval speed of the database itself, and the indexing method will not be detailed.
If you need to
CopyCode The Code is as follows: -- member table
If object_id ('userinfo', 'U') is not null
Drop table userinfo
Go
Create Table userinfo (userid int primary key, user_tegral int, level INT)
Insert into userinfo select 1, 0, 0
Go
-- Member level
I. symptom
When executing SQL Server distributed transactions, SQL Server 2005 receives the following error:
Message 7391, level 16, status 2, process XXXXX, 16th rows
This operation cannot be performed because the ole db access interface
CopyCode The Code is as follows: declare @ delstr nvarchar (500)
Set @ delstr = '' -- the injected field string
/*************************************** */
************/Set nocount on
Declare @ tablename nvarchar (100), @ columnname nvarchar (1
I have read a lot of scripts on the Internet.
Article The following steps have been completed, which can basically be called the Final Solution. Here we will give you a detailed explanation, hoping to help our updated friends and make our servers
CopyCode The Code is as follows: Create procedure [DBO]. [up_pager]
@ Table varchar (2000), -- table name
@ Col varchar (50), -- pagination by this column
@ Orderby bit, -- sort, 0-order, 1-inverted
@ Collist varchar (800), -- List of fields to be
You cannot create the same user and mapping this user to the database, and you cannot delete the Database User: deoffset.
Run the following script, and then you can delete the user: deoffset. then create the user (deoffset.) and map it to the
Create Database myindexdemo
Go
Use myindexdemo
Go
Create Table ABC
(
A int not null,
B char (10 ),
C varchar (10)
)
Go
Insert into ABC
Select 1, 'B', 'C'
Union
Select 5, 'B', 'C'
Union
Select 7, 'B', 'C'
Union
Select 9, 'B', 'C'
Go
Select * from
Version 1: Compare by Separator
Algorithm Train of Thought: truncate the search string loop by separator and compare it with the characters to be searched
CopyCode The Code is as follows: use [Fly]
Go
-- Parameter: @ instr string to be searched,
Copy codeThe Code is as follows: -- execute the sequence From Where Select
Select * from
(Select sal as salary, comm as commission from emp) x where salary -- Get Name Work as a Job
Select ename + 'work as a' + job as msg from emp where deptno = 10
-
This method is cumbersome, and it is difficult for people who do not know the database. I was tempted to write a small program. After two days of hard work, I finally met you. I hope you will give more comments to your children's shoes. After that,
Exec sp_droplinkedsrvlogin ZYB, Null -- delete ing (ing between recording and remote logon on the linked server)
Exec sp_dropserver ZYB -- delete the remote server Link
EXEC sp_addmediaserver@ Server = 'zyb', -- the alias of the accessed server@
Copy codeThe Code is as follows: USE TestDB
Declare @ conversation uniqueidentifier
While exists (select 1 from sys. transmission_queue)
Begin
Set @ conversation = (select top 1 conversation_handle from sys. transmission_queue)
End conversation
SQL Server itself provides such a DMV to return this information, which is sys. dm_exec_sessions.
For example, make a query on my machine:
Copy codeThe Code IS as follows: SELECT * FROM sys. dm_exec_sessions WHERE host_name IS NOT NULL
We can
There is only one php_pdo_odbc.dll.
So ~ The latest and best php Method for connecting to mssql is as follows:
Copy codeThe Code is as follows: $ Cnx = new PDO ("odbc: Driver = {SQL Server}; Server = 127.0.0.1; Database = test;", 'sa ', 'asd123
Ø basic common Query
-- Select
Select * from student;
-- All query all
Select all sex from student;
-- Duplicate distinct Filtering
Select distinct sex from student;
-- Count statistics
Select count (*) from student;
Select count (sex) from student;
The following code creates a table structure:
Copy codeThe Code is as follows: create table test_tb
(
TestId int not null identity (1, 1) primary key,
Caption nvarchar (100) null
);
GO
Solution 1:For this question, the first thought may be: Can I
1. scalar function: the result is a single value that can contain a logical processing process. Uncertain System functions such as getdate () cannot be used.
Copy codeThe Code is as follows: -- Scalar Value Function
-- ===============================
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.