Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does char(10) do in a dynamic t-sql string?

Tags:

tsql

I have a dynamic sql string in a existing procedure. What does the char(10) do?

Set @SelectStr = @SelectStr + ' And FC.FCode = ''' + @FCode + '''' + CHAR(10)

like image 814
marko Avatar asked Oct 04 '11 12:10

marko


1 Answers

CHAR(10) is the character represented by ASCII code 10, which is a Line Feed (\n) so its a new line.

(Although its not the windows standard new line which is Carriage Return + Line Feed CHAR(13)+CHAR(10))

In your example its probably just used to make the string more readable when its printed out.

like image 148
Alex K. Avatar answered Sep 19 '22 23:09

Alex K.