MS SQL

×

Error message

Warning: apc_store(): Potential cache slam averted for key 'www.hashbangcode.com::cache_bootstrap::variables' in DrupalAPCCache->set() (line 206 of /var/www/www.hashbangcode.com/2014-03-22-2105/docroot/sites/all/modules/contrib/apc/drupal_apc_cache.inc).
Posts about the Microsoft SQL database server

Round A Number In MS SQL

Monday, November 10, 2008 - 10:20

To round a number in MS SQL use the ROUND() function. This function takes two parameters, the first is the number to be rounded and the second is the number of decimal places to round the number to. Here is an example of rounding the numbers in a column to the nearest whole integer.

Category: 

Concatenate Strings In MS SQL

Friday, November 7, 2008 - 18:27

If you want to concatenate the output of three different columns in MS SQL just use the + symbol.

Category: 

Limit Number Of Rows Returned In MS SQL

Tuesday, September 23, 2008 - 09:34

To limit the number of rows returned in a MS SQL query you need to use the TOP command. This goes before you name the columns that are to be returned by the SELECT statement.

The following query returns the first 35 rows from a table.

 4 ORDER BY id DESC
Category: 

Getting A Random Row From A MS SQL Table

Wednesday, January 9, 2008 - 10:02

To get a random row from a Microsoft SQL database you need to use the NEWID() function. This will generate a new random number for each row and order them by that new number. This is used in conjunction with the TOP clause to limit the amount of returned rows to one.

 
Category: