Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 10 of 21 total |
A useful SQL function. |
Sun, Oct 8 2006 12:46 PM | Permanent Link |
Abdulaziz Jasser | Hope to see "Space" function in the next release (hopefully 4.25).
SELECT FirstName + Space(1) + SecondName + Space(1) + LastName FROM Table1; |
Sun, Oct 8 2006 1:12 PM | Permanent Link |
"Robert" | "Abdulaziz Jasser" <jasser@cyberia.net.sa> wrote in message news:5726C1A4-FD0A-48F3-B1A1-E9711C87D258@news.elevatesoft.com... > Hope to see "Space" function in the next release (hopefully 4.25). > > SELECT FirstName + Space(1) + SecondName + Space(1) + LastName FROM > Table1; > SELECT 'It'||' '||'is'||' '||'already'||' '||'there'||'.' |
Sun, Oct 8 2006 6:08 PM | Permanent Link |
"Ralf Mimoun" | Abdulaziz Jasser wrote:
> Hope to see "Space" function in the next release (hopefully 4.25). > > SELECT FirstName + Space(1) + SecondName + Space(1) + LastName FROM > Table1; Take a look at REPEAT. One more parameter, but it's there. Ralf |
Sun, Oct 8 2006 11:15 PM | Permanent Link |
Oliver Bock | Robert wrote:
> SELECT 'It'||' '||'is'||' '||'already'||' '||'there'||'.' There's something wrong with your code: I get "Missing FROM in SELECT SQL statement" Oliver |
Mon, Oct 9 2006 7:35 AM | Permanent Link |
Abdulaziz Jasser | Ralf,
At Run-Time you can not use REPEAT function. In other words you can not write this: Query.SQL.Add('SELECT FirstName + Repeat(' ',1) + SecondName + Repeat(' ',1) + LastName FROM Table1'); But with SPACE function you can. |
Mon, Oct 9 2006 9:45 AM | Permanent Link |
"Ralf Mimoun" | Abdulaziz Jasser wrote:
> Ralf, > > At Run-Time you can not use REPEAT function. In other words you can > not write this: > > > Query.SQL.Add('SELECT FirstName + Repeat(' ',1) + SecondName + > Repeat(' ',1) + LastName FROM Table1'); > > But with SPACE function you can. Ahm, you can... Query.SQL.Add('SELECT FirstName + Repeat('''' '''',1) + SecondName + Repeat('''' '''',1) + LastName FROM Table1'); These double quotes are not special to DBISAM. It's the standard way to write a single quote into a string via source code. Ralf |
Mon, Oct 9 2006 10:48 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | But why not simply
Query.SQL.Add('SELECT FirstName + QuotedStr(' ') + SecondName +QuotedStr(' ') + LastName FROM Table1'); I used QuotedStr to make it obvious but you could use '' '' ie quote quote space quote quote Roy Lambert |
Mon, Oct 9 2006 12:03 PM | Permanent Link |
Abdulaziz Jasser | Roy & Ralf,
I use QuotedStr to do the trick with DBISAM version 4 (Still evaluating and making the conversion from 3 to 4), but I didn't know that I can use "quote quote space quote quote" to do the same thing. Although this would make REPEAT function does the trick, but I still see SPACE function is more easy and direct? Thanks all.... Regards, Abdulaziz Jasser |
Mon, Oct 9 2006 12:53 PM | Permanent Link |
"Robert" | "Abdulaziz Jasser" <jasser@cyberia.net.sa> wrote in message news:79CE6570-86A0-4D88-86A6-A4D598BFC316@news.elevatesoft.com... > Roy & Ralf, > > I use QuotedStr to do the trick with DBISAM version 4 (Still evaluating > and making the conversion from 3 to 4), but I didn't know that I can > use "quote quote space quote quote" to do the same thing. Although this > would make REPEAT function does the trick, but I still see SPACE function > is more easy and direct? > Am I missing something? Why should "space" be a DBISAM function? It seems to me that it is an issue of Delphi concatenation of strings. If you code your SQL in place, you can do stuff such as select addr_city||', '||addr_state||' '||addr_zip from address if you are doing an SQL.Add string, why not code your own "space" function? function space(const HowMany : integer = 1) : string; var j : integer; begin result := ''; for j := 1 to HowMany do result := result + ' '; result := quotedstr(result); end; |
Mon, Oct 9 2006 2:16 PM | Permanent Link |
Abdulaziz Jasser | Robert,
<<if you are doing an SQL.Add string, why not code your own "space" function?>> I have already implemented this SPACE function for Delphi a couple years ago. But SQL SPACE function is different from the one used in Delphi. More SQL functions usefully give more power to the SQL engine and make the user's life easier. |
Page 1 of 3 | Next Page » | |
Jump to Page: 1 2 3 |
This web page was last updated on Wednesday, April 24, 2024 at 11:07 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |