A friend has a rebuild index job execution generally stops and asks me if I can see which index has been rebuild. It was thought that Sys.index or sys.objects would store similar information and the results were not found.On the Internet, SQL Server does not store similar information. However, because rebuild index automatically updates the statistics, the update time
Tags: SQL ServerA similar article was written earlier, which is used for developmentIf OBJECT_ID (n ' tf_data_timerange ', n ' FN ') is not null drop function Tf_data_timerange go create function Tf_data_timerang E (@startDate varchar (20),--Start date @endDate varchar (20),--End date @dataType INT--Data type 1: Hours 2: Day) returns @tem P table (int,monitortime varchar) as/********************************--function: Recursive generation
The following code is often used in php to obtain the SQL query statement for determining the date.
Copy codeThe Code is as follows: $ now = time (); // get the current date
$ SQL = "select * from 'team' where end_time> $ now ORDER BY sort_order limit 0, 4 ";
Obtain the MySql ti
PHP often through the following code, get the decision date of the SQL query statement
Copy Code code as follows:
$now = time (); Get the date of the current period
$sql = "SELECT * from ' the ' team ' where end_time> $now order by Sort_order limit 0,4";
gets the MySQL
The time function in SQL is very useful, especially when we are doing initial assignment, complex query, it is particularly convenient.
1. Get System Current Time
Select GETDATE ()
2, Datename (datepart, date) returns a string representing the specified date part of the specified date.
--Today is 2009-2-24--Tuesday
ASP millisecond count: the difference between the current 0 point of timer and the current time in milliseconds
Timer () decimal places
SQL can be set to three
JS delay unction dosomething (){// Step 1......// Step 2......// Step.........// Step n......}
Change to the following
Function Step1 (){...}Function step2 (){
Php processes database data. each time a data is processed, it returns the method in which the client displays the current status ., The current status of the database. Php processes database data. each time a data is processed, it returns the method in which the client displays the
Tags: and ring trigger sys modify type line from nbsp1. Sort all stored procedures by recent changes SELECT [name], [create_date], [modify_date] FROM [sys].[objects] WHERE [type] = ‘P‘ -- 这里也可以替换为:‘U‘,‘IF‘,‘TR‘分别代表用户表,自定义函数,触发器 ORDER BY [modify_date] DESC2. Query the creation and modification time of the specified stored procedureSelect[Name], Create_date, Modify_dateFromSys.all_objectswhereType_desc = N ' sql_stored_procedure 'and name = ' sp_system
, ' 2015-04-01 23:00 ') Select Pscode,outputcode, CONVERT (varchar (+), MIN (monitortime), + ' ~ ' +convert (varchar), MAX (monitortime), 120
) FW, COUNT (1) Num from (select X.pscode,x.outputcode,x.monitortime,dateadd (Hour,-x.orderby,x.monitortime) diff From (select Pscode,outputcode,monitortime, Row_number () through (partition by Pscode,outputcode ORDER by Pscode,ou Tputcode,monitortime) (from Test) x) y GROUP by Y.pscode,y.outputcode,y.diff Copyright NOTICE: This article for Bo Master
About the Combox binding SQL Server database The time fields are not duplicates in the following years:
private void Education_training_load (object sender, EventArgs e)
{
MyDBase DB = new MyDBase (Dbuser.sserver, Dbuser.dbname, Dbuser.suser, DBUSER.SPASSWD);
DataSet DS = DB. GetRecordSet ("SELECT DISTINCT (date) as date from Education_train");
if (DS. Table
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 ', '-')
--Long date format: YYYY year mm month DD Day
SELECT STUFF (STUFF (CONVERT (char (8), GETDATE (), 112), 5,0,n ' year '), 8,0,n ' month ') +n ' Day
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 CodeThe code is as follows:
--Short Date format: yyyy-m-d
SELECT REPLACE (CONVERT (varchar), GETDATE (), (), N '-0 ', '-')
--Long date format: YYYY year mm month DD Day
SELECT STUFF (STUFF (CONVERT (char (8), GETDATE (), 112), 5,0,n ' year '), 8,0,n ' month ') +n ' Day '
--Short date
Environment: SQL Server 2008 R2
Problem: Output information at query time
Solve:
One: Use the print function.
Such as:
print ' HelloWorld ';
Of course, the print function will not only be able to print strings, but also print integer data or floating-point data.
Such as:
print;
Print 39.27;
Print 0.11111111111111111111;
Two: The workaround method,
Php processes database data. Each time a data is processed, it returns the method in which the client displays the current status ., Current Database status
Php processes a large amount of data. Each time a piece of data is processed, the method returned to the client to display the
To operate on time in SQL, You need to master four time functions:Dateadd, datediff, datepart, datename.
Dateadd is to add or subtract a time on a specified date.For example, if you add a 3-day select dateadd (day, 3, '2017-05-06 ') on the specified date, the returned result is 2010-05-09.
Datediff is the date and
-31 23:59:59 '. ("support" means that although previous values may work, there is no guarantee).
Use the date type when you want only the value of the dates and do not need the time section. MySQL retrieves and displays date values in the ' YYYY-MM-DD ' format. The scope of support is ' 1000-01-01 ' to ' 9999-12-31 '.
The properties of the timestamp column type are not fixed, depending on the MySQL version and the
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.