SQL Server CHAR Function
Example Return the character based on the number code 65: SELECT CHAR(65) AS CodeToCharacter; Definition and Usage The CHAR() function returns the character based on the ASCII code. Syntax CHAR(code)
Example Return the character based on the number code 65: SELECT CHAR(65) AS CodeToCharacter; Definition and Usage The CHAR() function returns the character based on the ASCII code. Syntax CHAR(code)
SQL Server has many built-in functions. This reference contains string, numeric, date, conversion, and some advanced functions in SQL Server. SQL Server String Functions Function Description ASCII Returns the ASCII value for the specific character CHAR Returns the character based…
Example Return the ASCII value of the first character in “CustomerName”: SELECT ASCII(CustomerName) AS NumCodeOfFirstChar FROM Customers; Definition and Usage The ASCII() function returns the ASCII value for the specific character. Syntax ASCII(character)
FROM The FROM command is used to specify which table to select or delete data from. The following SQL statement selects the “CustomerName” and “City” columns from the “Customers” table: Example SELECT CustomerName, City FROM Customers; The following SQL statement…
FOREIGN KEY The FOREIGN KEY constraint is a key used to link two tables together. A FOREIGN KEY is a field (or collection of fields) in one table that refers to the PRIMARY KEY in another table.
EXISTS The EXISTS command tests for the existence of any record in a subquery, and returns true if the subquery returns one or more records. The following SQL lists the suppliers with a product price less than 20: Example SELECT…
EXEC The EXEC command is used to execute a stored procedure. The following SQL executes a stored procedure named “SelectAllCustomers”: Example EXEC SelectAllCustomers;
DROP VIEW The DROP VIEW command deletes a view. The following SQL drops the “Brazil Customers” view: Example DROP VIEW [Brazil Customers];
DROP TABLE The DROP TABLE command deletes a table in the database. The following SQL deletes the table “Shippers”: Example DROP TABLE Shippers; Note: Be careful before deleting a table. Deleting a table results in loss of all information stored…