Home
Q&A
Education
Technology
Credit
General
Health
Insurance
Questions
Ask a Question
How to insert a line break in a SQL Server VARCHAR/NVARCHAR string
Home
Education
How to insert a line break in a SQL Server...
asked
Feb 5, 2022
in
Education
by
JackTerrance
I didn't see any similar questions asked on this topic, and I had to research this for something I'm working on right now. Thought I would post the answer for it in case anyone else had the same question. Select the correct answer from above options
sql
sql-server
line-breaks
1
Answer
0
votes
answered
Feb 5, 2022
by
JackTerrance
Best answer
char(13) is CR(Carriage Return) . For DOS-/Windows-style CRLF linebreaks, you need to use char(13)+char(10), like this: 'This is line 1.' + CHAR(13)+CHAR(10) + 'This is line 2.'
Related questions
0
votes
Q: How to insert a line break in a SQL Server VARCHAR/NVARCHAR string
I didn't see any similar questions asked on this topic, and I had to research this for something I'm working ... had the same question. Select the correct answer from above options...
asked
Feb 8, 2022
in
Education
by
JackTerrance
sql
sql-server
line-breaks
0
votes
Q: How to concatenate text from multiple rows into a single text string in SQL server?
Consider a database table holding names, with three rows: Peter Paul Mary Is there an easy way to turn this into ... Peter, Paul, Mary? Select the correct answer from above options...
asked
Jan 28, 2022
in
Education
by
JackTerrance
sql
sql-server
csv
string-concatenation
group-concat
0
votes
Q: How can I list all foreign keys referencing a given table in SQL Server?
I need to remove a highly referenced table in a SQL Server database. How can I get a list of all the ... of the management studio.) Select the correct answer from above options...
asked
Jan 28, 2022
in
Education
by
JackTerrance
sql
sql-server
tsql
0
votes
Q: How to return only the Date from a SQL Server DateTime datatype
SELECT GETDATE() Returns: 2008-09-22 15:24:13.790 I want that date part without the time part: 2008-09-22 00: ... How can I get that? Select the correct answer from above options...
asked
Jan 28, 2022
in
Education
by
JackTerrance
sql
sql-server
tsql
date
datetime
0
votes
Q: How do I UPDATE from a SELECT in SQL Server?
In SQL Server, it's possible to insert into a table using a SELECT statement: INSERT INTO Table (col1, col2, ... .id = other_table.id Select the correct answer from above options...
asked
Jan 26, 2022
in
Education
by
JackTerrance
sql
sql-server
tsql
select
0
votes
Q: How to get first character of a string in SQL?
I have a SQL column with a length of 6. Now want to take only the first char of that column. Is there any ... in SQL to do this? Select the correct answer from above options...
asked
Feb 8, 2022
in
Education
by
JackTerrance
sql
sql-server
sql-server-2005
0
votes
Q: How to get first character of a string in SQL?
I have a SQL column with a length of 6. Now want to take only the first char of that column. Is there any ... in SQL to do this? Select the correct answer from above options...
asked
Feb 5, 2022
in
Education
by
JackTerrance
sql
sql-server
sql-server-2005
0
votes
Q: Count(*) vs Count(1) - SQL Server
Just wondering if any of you guys use Count(1) over Count(*) and if there is a noticeable difference in ... SQL Server 2005.) Select the correct answer from above options...
asked
Jan 28, 2022
in
Education
by
JackTerrance
sql
sql-server
performance
0
votes
Q: Add a column with a default value to an existing table in SQL Server
How can a column with a default value be added to an existing table in SQL Server 2000 / SQL Server 2005? Select the correct answer from above options...
asked
Jan 26, 2022
in
Education
by
JackTerrance
sql
sql-server
sql-server-2005
sql-server-2000
0
votes
Q: Where can I learn Microsoft SQL Server?
Could anybody tell me where I can learn Microsoft SQL Server? Select the correct answer from above options...
asked
Jan 6, 2022
in
Education
by
JackTerrance
sql
ms-sql
sql-server
0
votes
Q: Insert results of a stored procedure into a temporary table
How do I do a SELECT * INTO [temp table] FROM [stored procedure]? Not FROM [Table] and without defining [ ... not supply any columns. Select the correct answer from above options...
asked
Jan 28, 2022
in
Education
by
JackTerrance
sql
sql-server
sql-server-2005
tsql
stored-procedures
0
votes
Q: How do I perform an IF…THEN in an SQL SELECT?
How do I perform an IF...THEN in an SQL SELECT statement? For example: SELECT IF(Obsolete = 'N' OR ... Saleable, * FROM Product Select the correct answer from above options...
asked
Jan 28, 2022
in
Education
by
JackTerrance
sql
sql-server
tsql
if-statement
case
0
votes
Q: How long will it take to learn SQL?
Can anyone tell me how long will it take to learn SQL? Select the correct answer from above options...
asked
Jan 19, 2022
in
Education
by
JackTerrance
sql
sql-server
0
votes
Q: SQL reporting invalid syntax when run in Power BI
I have written an SQL script which runs fine when executed directly in SQL Management Studio. However, when entering ... are removed: Select the correct answer from above options...
asked
Feb 8, 2022
in
Education
by
JackTerrance
sql
sql-server
powerbi
0
votes
Q: SQL User Defined Function Within Select
I have a user defined function in SQL called getBuisnessDays it takes @startdate and @enddate and returns the number of ... WHERE ... Select the correct answer from above options...
asked
Feb 8, 2022
in
Education
by
JackTerrance
sql
sql-server
select
user-defined-functions
...