Sample Table Sample


/ Published in: SQL
Save to your folder(s)

Alternate to tablesample clause. Example from BOL

"The expression CAST(CHECKSUM(NEWID(), SalesOrderID) & 0x7fffffff AS float / CAST (0x7fffffff AS int) evaluates to a random float value between 0 and 1"


Copy this code and paste it in your HTML
  1. SELECT * FROM Sales.SalesOrderDetail
  2.  
  3. WHERE 0.01 >= CAST(CHECKSUM(NEWID(), SalesOrderID) & 0x7fffffff AS FLOAT)
  4.  
  5. / CAST (0x7fffffff AS INT)

URL: http://msdn.microsoft.com/en-us/library/ms189108.aspx

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.