devxlogo

Coding blank spaces in a select statement

Coding blank spaces in a select statement

Question:
After the line break in the code below, the blankspace between the quotes is not recognized. I am merely trying to indent the second line, but I get nothing. The field is eventually accessed from an ASP page which explains the html statement in the code.

SELECT RTRIM(Item.unit_pack1) + ' pack(s) @ $' + CONVERT(varchar(8), CONVERT(money, Item.unit_price1)) + ' added to your shopping bag.
' + ' ' + RTRIM(Brand_List.brand_descript)AS qof_descriptFROM ..............

Answer:
Instead of the blank string which apparently getschopped, try declaring a variable named @filler of varchar(100) and then wrap the select statementin a cursor.

Each time you go through an iteration of purchasing stuff, add another ten spaces into filler so it indented one more level in for every purchase made.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist