Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 4 of 4 total |
CAST in my SQL |
Tue, Apr 7 2009 8:15 PM | Permanent Link |
Pat | Hi all,
this works fine in dbsys (v4) SELECT DISTINCT CAST(Payroll.PayrollCode AS Integer) AS "Integer Payroll Code" FROM PayTran LEFT JOIN Payroll ON PayTran.PayrollID = Payroll.PayrollID ORDER BY "Integer Payroll Code" but when I put the following in my app I get error #11949 - expect column name but found 'Payroll Code'. SQL.Add('SELECT DISTINCT CAST(Payroll.PayrollCode AS Integer) AS ' + QuotedStr('Payroll Code') + ' '); SQL.Add('FROM PayTran'); SQL.Add('LEFT JOIN Payroll ON PayTran.PayrollID = Payroll.PayrollID'); SQL.Add('ORDER BY ' + QuotedStr('Payroll Code') + ' '); I have tried variations of ) and ( and ' around the CAST, but still cannot get it to compile Any ideas? Thanks. Regards, Pat |
Tue, Apr 7 2009 8:46 PM | Permanent Link |
"Jeff Cook" | Kia Orana Pat
> ORDER BY "Integer Payroll Code" > > SQL.Add('ORDER BY ' + QuotedStr('Payroll Code') + ' '); > It's because these give you different strings:- 1. "Integer Payroll Code" 2. 'Integer Payroll Code' DBISAM treats things in double quotes as column names and things in single quotes as literals. You need either SQL.Add('ORDER BY "Payroll Code" '); or simply SQL.Add('ORDER BY 1'); Kia Manuia Jeff -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz + Joan and Jeff Cook The Cooks Oasis www.cookislandsoasis.com |
Tue, Apr 7 2009 10:28 PM | Permanent Link |
Pat | Hi Jeff,
>1. "Integer Payroll Code" >2. 'Integer Payroll Code' > >DBISAM treats things in double quotes as column names and things in >single quotes as literals. Jackpot!! that's the reason, thanks Jeff. Pat PS. you're not in this are you? http://www.youtube.com/watch?v=R0QQIDJ2j30 |
Wed, Apr 8 2009 4:19 AM | Permanent Link |
"Jeff Cook" | Pat wrote:
> > PS. you're not in this are you? > http://www.youtube.com/watch?v=R0QQIDJ2j30 Nope! I'd love to be in it but the old legs aren't up to it! -- Jeff Cook Aspect Systems Ltd www.aspect.co.nz + Joan and Jeff Cook The Cooks Oasis www.cookislandsoasis.com |
This web page was last updated on Tuesday, May 7, 2024 at 06:25 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |