Copy codeThe Code is as follows:/*-- Set uppercase letters for the first character string in SQLServer:-- Author: jinjazz/csdn-- Enable OLEAutomation in SQLServer2005Sp_configure 'show advanced options', 1;GoRECONFIGURE;GoSp_configure 'ole
Copy codeThe Code is as follows:Public partial class CMS_DBDataContext{Partial void OnCreated (){// Create a database if the database does not existIf (! This. DatabaseExists ()){This. CreateDatabase ();}}} The following error occurs: the create
1. Given a date value, obtain the date data of the Monday and Sunday of the week where the date is located.For example, if you specify a date, find that its Monday of the week is, and Sunday is.Function is created as follows:Copy codeThe Code is as
There are two tables with identical structures, one of which inserts data with the specified conditions in the other table, and the following error is reported:Only when the column list is used and IDENTITY_INSERT is ON can an explicit value be
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 the time
Copy codeThe Code is as follows:-- Create a test tableDECLARE @ Users TABLE(Id int identity (1, 1 ),UserInfo XML)--- Insert Test DataDECLARE @ xml XMLSET @ xml =' 1 test1 'Insert into @ Users (UserInfo) VALUES (@ xml)-- Insert a single node (type:
Powerful groupCopy codeThe Code is as follows:Select stdname,Isnull (sum (case stdsubject when 'chemistry 'then Result end), 0) [chemistry],Isnull (sum (case stdsubject when 'mate' then Result end), 0) [math],Isnull (sum (case stdsubject when
No.
Standard landCode)
Segment encoding (sectCode)
1
131001BG001
G001
2
131001BG002
G001
3
131001BG003
G001
4
131001BG004
G002
5
131001BG005
G003
Now you need to
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 LinkEXEC sp_addmediaserver@ Server = 'zyb', -- the alias of the accessed server@
In the past, SQL had a stuff function, which was very powerful.The format of a column is a number followed by a single quotation mark (single quotation mark) with four digits, for example, '2017, '2017, '2017. I want to convert it to a format like 00
We will continue to use the previous example. The preceding table contains basic information about an employee, such as name, gender, date of birth, and place of birth. Create another table to describe the articles published by employees, including
Assume that there is a student renewal table (tb) as follows:Name Subject ResultZhang San Language 74James math 83Zhang San physical 93Li Si language 74Li Si mathematics 84Li Si physical 94Want to becomeName, Chinese, Mathematics, Physics------------
Modify:Copy codeThe Code is as follows:Declare proccur cursorForSelect [name] from sysobjects where name like 'Foods _ %'Declare @ procname varchar (100)Declare @ temp varchar (100)Open proccurFetch next from proccur into @ procnameWhile (@
Existing table A has the following content:
Code repository quantity 01 A 6 01 B 7 02 A 8 02 B 9
Now you want to query this format by encoding:
01 A 6 01 B 7 Summary Subtotal: 13 02 A 8 02 B 9 Summary Subtotal: 17
Q:
I will introduce the concept of join. For this reason, I have prepared two trial tables: album (album table) and track (track table ).Album: contains the summary of 200 music CDs from Amazon.Album (asin, title, artist, price, release, label,
Yesterday I talked to my friends online about the application of SQL statements. My friend's remote server was unable to connect. The problem was that the remote server reached the maximum number of connections. In order to enable remote restart, I
Usage:Temporary tables can be used to store related records for complex queries, which can improve efficiency and program readability, similarMy_cursor declare my_cursor cursor scrollFor select field from tablenameTemporary tables are divided into
If you encounter problems after installing SQL2000 Personal Edition, install the application and click the application. The preceding figure shows that the initialization of the application fails normally. A value of 0 multiplied by C0000135 fails ).
Recently, I found a batch replacement of inserted Trojan records and found a good statement, which is very useful. I only use a dozen rows of cursor statements, the malicious trojan of all tables in the database is cleared, and the probability of
Fixed server role descriptionSysadmin performs any activity on SQL Server. This role's permissions span all other fixed server roles.Serveradmin configures the Server Range settings.Setupadmin adds and deletes the linked server and executes some
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.