Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL Server
Expertise: Beginner
Jul 16, 1999

Coding blank spaces in a select statement

Question:
After the line break in the code below, the blank space 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_descript FROM ..............

Answer:
Instead of the blank string which apparently gets chopped, try declaring a variable named @filler of varchar(100) and then wrap the select statement in 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.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date