Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
asuni
Yak Posting Veteran
55 Posts |
Posted - 2010-03-25 : 01:58:49
|
| Hi All,I am using SQL Server 2005.I want to get ASCII decimal code of the first character in a string, is there any function like this.For Ex: if a function is there like this : function name('ABC')this should return 65thanks you very much |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-03-25 : 02:02:19
|
| Try this:Declare @Test Varcharset @Test ='Sample'Select ascii(left(@Test,1))Regards,BohraI am here to learn from Master and help new bees in learning. |
 |
|
|
asuni
Yak Posting Veteran
55 Posts |
Posted - 2010-03-25 : 02:03:55
|
| Thank you very much |
 |
|
|
asuni
Yak Posting Veteran
55 Posts |
Posted - 2010-03-25 : 02:09:55
|
| Declare @Test Varcharset @Test ='Sample'Select ascii(@Test)This is also workingThanks |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2010-03-25 : 02:09:58
|
| Write you own functionCreate function [dbo].Convert_Ascii(@input_string varchar(100))returns intasbeginreturn ascii(left(@input_string,1))EndSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
asuni
Yak Posting Veteran
55 Posts |
Posted - 2010-03-25 : 02:10:31
|
| ya this is also fine thanks you very much |
 |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-03-25 : 02:14:33
|
welcome |
 |
|
|
|
|
|