what is the use of char function
-
Thursday, February 21, 2013 8:55 PMi am a beginner..i can't understood..can any one please explain
All Replies
-
Thursday, February 21, 2013 9:01 PM
The CHAR function returns a char for an ASCII code, for example
SELECT CHAR(65)
returns a "A", because 65 is the ASCII code for A ; see also CHAR (Transact-SQL)Olaf Helper
Blog Xing- Proposed As Answer by Naomi NMicrosoft Community Contributor, Moderator Thursday, February 21, 2013 9:06 PM
- Marked As Answer by Kalman TothMicrosoft Community Contributor, Moderator Friday, March 01, 2013 4:15 PM
-
Thursday, February 21, 2013 9:02 PM
http://msdn.microsoft.com/en-us/library/ms187323.aspx
DECLARE @i INT=65 WHILE (@i<=99) BEGIN PRINT CHAR(@i) SET @i=@i+1 END
Narsimha
- Proposed As Answer by Naomi NMicrosoft Community Contributor, Moderator Thursday, February 21, 2013 9:05 PM
- Marked As Answer by Kalman TothMicrosoft Community Contributor, Moderator Friday, March 01, 2013 4:15 PM
-
Thursday, February 21, 2013 9:08 PMTHEN WHAT ABOUT "Control characters" in char functions
-
Thursday, February 21, 2013 9:10 PMTHEN WHAT ABOUT "Control characters" in char functions
-
Thursday, February 21, 2013 9:18 PMModeratorYou can use CHAR(13) to insert carriage return.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog -
Thursday, February 21, 2013 9:28 PM
Or do it the other way around. Use testing against CHAR(13) and CHAR(10) to test for CR and LF. In days gone by, the stored procedure, trigger, rule and default definitions were stored in a table called syscomments. The table syscomments used to have a column called "text", I think, of the type varchar(255), and an integer column colid or something. If you read the table for the object_id of a certain proc in order of colid, and split the lines in the column text whenever you hit <CR><LF> (or CHAR(13) + CHAR(10)), and pasted the end of a line to the start of the next one, you had the text of the proc back in a readable format. These days, it is much simpler, yust read sys.sql_modules.definition for the object_id of your proc.- Marked As Answer by Kalman TothMicrosoft Community Contributor, Moderator Friday, March 01, 2013 4:16 PM

