Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Adding Spaces within a String

Author  Topic 

wruwtrix
Starting Member

2 Posts

Posted - 2011-08-11 : 16:35:50
I'm an SQL novice - just editing some code already in a program. This SQL query pulls information from a database to form a string that will be used in a report. The new coding is in red, and my problem area is underlined.

I’m trying to format two strings together with a space between them. The first part of the string is a code that references back to another table and says something like "While Drilling" or "After Installation". The second part of the string is a number from a field that can be converted to metric (the CONVERT part of this code). The third part of the string are the Notes from another table. I want a tab between part one and part two, and a few spaces between parts 2 and part 3. The Tab part is working, but the spaces aren’t.

Do you know how to add some spaces between items 2 and 3?

<<Let(Data = <<User System Data.Water Level SQL - all fields>>)>>_
<<Iterate(_
Index,_
1,_
<<ListCount(<<Get(Data)>>,<<Get(RecordSep)>>)>>,_
1,_
<<CR>>,_
<<Let(Record = <<GetListItem(<<Get(Data)>>,<<Get(RecordSep)>>,<<Get(Index)>>)>>)>>_
<<Let(Code = <<GetListItem(<<Get(Record)>>,<<Get(FieldSep)>>,1)>>)>>_
<<Let(Hours = <<GetListItem(<<Get(Record)>>,<<Get(FieldSep)>>,3)>>)>>_
<<Let(Depth = <<GetListItem(<<Get(Record)>>,<<Get(FieldSep)>>,4)>>)>>_
<<Let(Stickup = <<GetListItem(<<Get(Record)>>,<<Get(FieldSep)>>,5)>>)>>_
<<Let(Dry = <<GetListItem(<<Get(Record)>>,<<Get(FieldSep)>>,6)>>)>>_
<<Let(Notes = <<GetListItem(<<Get(Record)>>,<<Get(FieldSep)>>,7)>>)>>_
<<DelimitData(,<<Get(Hours)>>," hrs ")>>_
<<Lookup(<<WATER LEVEL EVENT.Description>>,<<Get(Code)>>)>>_
<<TAB!1.45;R>>_
<<UnitsConvert(_
<<Calc(<<Get(Depth)>> - <<Val(<<Get(Stickup)>>)>>)>>,_
<<User System Data.Ft M Factor>>,_
<<User System Data.Ft M Format>>_
)>>_
<<' '>>_
<<Get(Notes)>>_

<<IIf(<<Get(Dry)>>,Dry)>>_
)>>

Thanks for your help!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-08-11 : 17:01:44
This doesn't look like a SQL question. What language is this?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

wruwtrix
Starting Member

2 Posts

Posted - 2011-08-11 : 18:29:28
It's a program called gINT that utilizes SQL queries within. I was worried that it was a hybrid between SQL and their other programming protocols. Any ideas about programming in spaces would be appreciated though.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-08-11 : 20:15:40
I found some tutorials on their web site: http://www.gintsoftware.com/support_doc.html#tutorials

Check the one on "Using Data Design", it's a PDF with some tips. Not sure if it will help but it's all I could find.
Go to Top of Page
   

- Advertisement -