Skip to main content

SQL Buil-In Functions, String Functions,ASCII

Returns the ASCII code value of the leftmost character of a character expression.
Transact-SQL Syntax Conventions

Syntax


ASCII ( character_expression )

Arguments

character_expression
Is an expression of the type char or varchar.

Return Types

int

 Examples
 SET TEXTSIZE 0
SET NOCOUNT ON
-- Create the variables for the current character string position
-- and for the character string.
DECLARE @position int, @string char(15)
-- Initialize the variables.
SET @position = 1
SET @string = 'Du monde entier'
WHILE @position <= DATALENGTH(@string)
   BEGIN
   SELECT ASCII(SUBSTRING(@string, @position, 1)),
      CHAR(ASCII(SUBSTRING(@string, @position, 1)))
    SET @position = @position + 1
   END
SET NOCOUNT OFF
GO

Here is the result set.

----------- -
68          D
             
----------- -
117         u
             
----------- -
32           
             
----------- -
109         m
             
----------- -
111         o
             
----------- -
110         n
             
----------- -
100         d
             
----------- -
101         e
             
----------- -
32           
             
----------- -
101         e
             
----------- -
110         n
             
----------- -
116         t
             
----------- -
105         i
             
----------- -
101         e
             
----------- -
114         r






Reference:: SQL Online BOOKS

Comments

Popular posts from this blog

PHP DATABASE CONNECTION

//connecting to db $conn = mysql_connect("localhost","peter","abc123"); if (!$conn) { die('Could not connect: ' . mysql_error()); } // some code mysql_close($conn); // closing connection //query db $data=$conn->query("SELECT * FROM myTable "); foreach($data as $row) { print_r($row); }

CUSTOM WHERE CLASS IN SUGARCRM DASHLETS

How to add custom where class in sugar dashlets??? for example if you want to see top opportunities dashlet containing only filtered opportunities on some condition then you can do this as below require_once(‘modules/Opportunities/Dashlets/MyOpportunitiesDashlet/MyOpportunitiesDashlet.php’); class MyOpportunitiesCustomDashlet extends MyOpportunitiesDashlet { function MyOpportunitiesCustomDashlet($id, $def = null) { global $current_user, $app_strings, $dashletData; require(‘modules/Opportunities/Dashlets/MyOpportunitiesDashlet/MyOpportunitiesDashlet.data.php’); parent::MyOpportunitiesDashlet($id, $def); } function process($lvsParams = array()) { $lvsParams = array( ‘custom_select’ => ”, ‘custom_from’ => ”, ‘custom_where’ => ‘ AND opportunities.sales_stage=\’Qualification\”, ‘distinct’ => true ); parent::process($lvsParams); } } these codes are only hints, you should know where these piece of codes should be placed to be working..

AJAX BANNED MODULES

In SugarCRM if you want to ban ajax only for particular modules then go to your config_override.php file and add this code $sugar_config['addAjaxBannedModules'][] = “KReports”; //disable ajaxgui for specific module in config override. Now you have done