'+ident_incr('Student ') SQL returns the number of rows affected by the previous statement: @ @ROWCOUNT Returns the number of rows affected (insert, select, Delete, update): 1 Select * from where S_sex=' female '
2
3Select @@ ROWCOUNT -- return 6 If the number of rows is greater than 2 billion, use Rowcount_big (). 1 Select * from where S_sex=' male ';
2
3 Select Rowcount_big () -- return 9 ROWCOUNT usage: The function of rowcount is to
I believe most people have come across that when processing data, the value of the field is separated by ', ' (comma), so I can't avoid it.Then I learned that SQL is no way to split a string like C # and Javascript. (Split)So I've defined a SQL function (a multi-declaration table-valued function), with the following code:1 Use [Test]2 GO3 /** * * * object:userdefinedfunction [dbo]. [Split] Script DATE:
the case for the first day of the year ELSE IF (DATEPART (WEEKDAY, @DAT E) = 1 and DATEDIFF (DayOfYear, @FIRST_DATE_OF_YEAR, @DATE)/7 + 1 Test:DECLARE @DATE datetime = ' 2017-01-02 ' DECLARE @FIRST_DATE_OF_YEAR datetime = DATEADD (Yyyy,datediff (yyyy,0, @DATE), 0) SELECT DATEPART (WEEK, @DATE),--Week of the year, the default starts in Sunday DATEADD (Wk,datediff (wk,0, @DATE), 0),--the current week of Monday, the default starting from Sunday,
This article is original article, reprint please indicate the source! My blog address: http://www.cnblogs.com/txwdAs a result of the work, for more than a year now for this has not written SQL Server storage process, has been a little rusty. Recently work has a table of data needs to be updated regularly, turn over the previously written storage process, in this record.The requirement is this:There are two
number INT IDENTITY (101,1) PRIMARY KEY, 19 20 name varchar () not NULL, 21 22 live in varchar (50), 23 24 Mobile Number CHAR (one) UNIQUE not NULL check (mobile number like ' 1[358][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] '), 26 27 ID number CHAR (s) UNIQUE not NULL check (left (ID number, s) "[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0- 9][0-9][0-9][0-9][0-9][0-9][0-9] ' and (Right (ID number, 1) like ' [0-9] ' or right (ID card number, 1) like ' X ') 31) 32 33 34--Create bank
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.