Execute in Query Analyzer: Select rand (), you can see that the result is similar to a random decimal: 0.36361513486289558, a decimal like this is used in the actual application is not much, generally to take random numbers will take random integers.
The ceiling function and the floor function in SQL Server:The ceiling function returns the smallest integer greater than or equal to the given numeric expression.The floor function returns the largest integer less than or equal to the given number
Problem
Recently I tried to use rounded values in my application, and my users were divided about the computational problems in the report application. All of the code is in T-SQL, but I think the report problem is closely related to the data type
COPIED from:http://www.cnblogs.com/wuming/archive/2010/02/24/1672906.htmlFrom a table random 2 records, with select TOP * from Ywle ORDER by NEWID () the order by is generally sorted by a field, the return value of newid () is uniqueidentifier,
Randomly fetch 2 records from a table, using select TOP * from Ywle ORDER by NEWID ()Order by is generally sorted by a field, the return value of newid () is uniqueidentifier, and the Order by NEWID () random selection record is performedNEWID ()
The Random Functions NewID (), Rand (), newidrand in SQL server
In SQL Server, random functions include rand (), NewID (), where rand is a random number from 0 to 1, and NewID is the unique identifier of the random uniqueidentifier generated.
SELECT
In SQL Server, random functions have rand (), NewID (), where Rand is randomly fetched in 0 to 1, and NewID is a random uniqueidentifier unique identifier.
SELECT * from Northwind.. Orders by NEWID ()--Random sort
SELECT Top * from Northwind..
http://blog.csdn.net/dxnn520/article/details/8454132==================================================== "Rounding to take the whole intercept"Select Round (54.56,0)==================================================== "Take down the whole
After a period of study, I have some knowledge about databases. databases are basically composed of tables, relationships, and operations.
After a period of study, I have some knowledge about databases. databases are basically composed of tables,
Transferred from: http://database.51cto.com/art/201009/224397.htmThe following will introduce you to the random function rand () in SQL, for your reference, if you are new to SQL Server, you might want to look at it and believe it will help you
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.