Increase the size of a nvarchar column

//Increase the size of the TagName column try { SqlCommand1 = gcnew SqlClient::SqlCommand(); SqlCommand1->Connection = SqlConnection1; SqlCommand1->CommandType = CommandType::Text; SqlCommand1->CommandText = “ALTER TABLE tblTagDefinitions ALTER COLUMN TagName [nvarchar](200) NULL”; affected = SqlCommand1->ExecuteNonQuery(); //affected = number of rows affected } catch (Exception ^) { }

Read More

Manipulating Returned Results

$sql1 = "SELECT indexer, user_id, friends_id AS from_id, //Change result name to from_id 'friend' AS type, //For each record found add a result called 'type' containing 'friend' todays_date FROM friends WHERE friends_id = $user_id"; Outputting Results As A Comma Separated List (Or any character separated) $QueryString = "SELECT CONCAT_WS(',',SomeColumnName0,SomeColumnName1,SomeColumnName2) FROM MyTable WHERE SomeColumn = 12"; //"CONCAT_WS(','," […]

Read More

Case Sensitivity

Select is not case sensitive by default SELECT * FROM myTable WHERE ‘something’ = ‘Something’ = 1 To make it case sensitive use a select with binary SELECT * FROM myTable WHERE BINARY ‘something’ = ‘Something’ //or SELECT * FROM myTable WHERE ‘something’ = BINARY ‘Something’ = 0

Read More

JOIN to get results from 2 tables

Using JOIN to get results from two tables This is PHP4 Code! Example 1 Example 2 Using JOIN to get results from three tables This is PHP4 Code! Example 1 Using GROUP BY To Get One Row Per Match This is PHP4 Code! Note – when using GROUP BY, if you also use ORDER BY […]

Read More

Reload page

Reload the current page Form reloads current page Link reloads current page Reload current page but with post values stripped Using javascript Periodic Refresh

Read More

.UPDATE general

Object Oriented Style How many rows were affected Procedural Style Maths Operations In Update Queries Add text to an existing text field

Read More

Columns Data Types

Quick Data Types List (For a more in depth description see below) Numeric BOOL Use TINYINT BIT The BIT data type is used to store bit-field values. A type of BIT(M) enables storage of M-bit values. M can range from 1 to 64.  (Not universally supported) INT A normal-sized integer that can be signed or unsigned. […]

Read More

.SELECT General

Object Oriented Style Does Record Exist Simple Get A Result Alternative with check for no result Get Each Row Returned Procedural Style Does Record Exist Simple Get A Result Get Each Row Returned Get Number Of Rows Returned Get Specific Columns Get each field as a variable named as the field Using OR Arguments Putting All […]

Read More

.DELETE General

Object Oriented Style Procedural Style Delete old records by date Delete table Truncate is the fastest method to delete all data in a table as the table is dropped and re-creaed.

Read More