Jump to content

Squall_FF8

Members
  • Content Count

    94
  • Joined

  • Last visited

Community Reputation

2 Neutral

Technical Information

  • Delphi-Version
    Delphi 12 Athens

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Squall_FF8

    Short for a function

    Thank you, excellent find! Although there is some logic behind the reason .... I find it very: meh. It is always developer's responsibility for the names, not MS (to help us in possible future). We know that using keywords/possible keywords like Name, Value,... could be dangerous. Anyway it is decided long time ago, so regardless what we say or think now will not change it.
  2. Squall_FF8

    Short for a function

    Hey guys, I'm using MS SQL 2008 and I have a function fn_Test with one input param. when I try: select fn_Test(...) ... I get: 'fn_Test' is not a recognized function name. If I try dbo.fn_Test - it works. Is it possible to make it work without dbo?
  3. Squall_FF8

    Strange Error

    OK. Now it all make sense! Thank you very much for your patience, time and the GREAT help!!! I've seen in the help that all examples include explicit joins, but I didnt know that is required by the SQL-92. Its time for me to move from old style to 92 😎
  4. Squall_FF8

    Strange Error

    I dont understand that. when you write: from TableA, TableB --that is equal to: from TableA cross join TableB but it seems, that is not the case for MS .. BTW if I use cross join instead of comma it works..
  5. Squall_FF8

    Strange Error

    Yes, many to many. Thank you for your code, That would come in handy later on. It seems to me, that when we have a product (Table x Table) in FROM clause, LEFT JOIN clause can't distinguish individual tables. So m in ON part is not Users_Module, but rather the whole product (Role x Module). Does anybody knows more about that? Why only in LEFT JOIN? is this MS SQL thing (bug?) or SQL standard?
  6. Squall_FF8

    Strange Error

    Hey guys, I'm using Microsoft SQL 2005. I have the following SQL: and it gives me the error: Msg 4104, Level 16, State 1, Line 3 The multi-part identifier "r.ID" could not be bound. Do you know why? It looks to me, like it doesnt recognize Users_Role r, in the left join (but it recognizes m.ID) BTW the goal is - when I choose a Role (by ID) to get the rights (from Users_RoleToModule) set about all Modules (all record from it). Users_RoleToModule might not have records at all, or only some for the pairs <RoleID, ModuleID>.
  7. Squall_FF8

    RTF, MS SQL and queries

    Hi guys, I use MS SQL 2005. I have a table with a field that holds RTF, lets call it Rich. That works great in Delphi - I can show, save, and edit it. However when it comes to searching ... I have a problem: The text contain Cyrillic and RTF codes it with literals like "\'f0". And the problem is queries that uses things like "LIKE" dont work. So I wonder is there a way to return the text of the field as plain text? Or is there any other ways?
  8. Squall_FF8

    Delphi procedure -> MS SQL stored procedure

    The hardest part for me is - how to do Next on SQL query inside procedure. Also is it possible to do Lookup, without re-running the same SQL statement each iteration
  9. Hey guys, I have written a procedure in Delphi, but would like to port it to MS SQL. Unfortunately I'm new to MSSQL so If you have time to lift a hand, even with parts of it - that would be of great help!!! The structure: 3 tables - Contract - with contract info. It has Date_Sign, Date_Start, Date_Stop, MonthlyTax - Payment - keep records of paid taxes for each Month/Contract. It has DatePayment, Year, Month, Amount - Annex - keep track when the tax has been changed. It has Date and Amount I'm trying to create a procedure in MSSQL that takes ContractID and returns - Months - number of months without payment - Owes- sum of all taxes that hasn't been paid procedure TfmContractEdit.BuildChrono; var y, m, d: word; d1, d2: tDate; pay: Currency; // keeps track of what current tax that needs to be paid begin if deStart.Enabled then d1 := deStart.Date else d1 := deSign.Date; d1 := RecodeDay(d1, 1); if deStop.Enabled then d2 := deStop.Date else d2 := Date; d2 := RecodeDay(d2, 1); DM.Qry.Open(format(sql_GetAnnex, [ID])); // ID is ContractID DM.Qry2.Open(format(sql_GetPaymentTax, [ID])); pay := cuMonthTax.Value; // Current Contract tax var Sum: Currency := 0; var MonthDebt: integer := 0; while d1 < d2 do begin if (not DM.Qry.Eof) and (d1 >= DM.Qry.FieldByName('Date').AsDateTime) then begin pay := DM.Qry.FieldByName('Amount').AsCurrency; DM.Qry.Next; end; DecodeDate(d1, y, m, d); var v: variant := DM.Qry2.Lookup('Year;Month',VarArrayOf([y, m]), 'MonthlyTax'); if VarIsNull(v) then begin Sum := Sum + pay; inc(MonthDebt); end; d1 := IncMonth(d1); end; // Returns Sum, MonthDebt
  10. Wow it worked! Thank you VERY MUCH, @weirdo12 !!!! I had never created variables in FR itself (just trough Delphi code). That is a very neat trick! Thank you for taking time for the screenshots and step by step how to do it!
  11. @weirdo12 Great example and practical illustration!!! May we adapt it, if the text is in RichView (instead of Memo) and it is more complicated, like: xxxxx [Ticket."ticket_date"] xxxxxx
  12. Good old Convert ... I'm wondering is there more convenient way - to set format per session, like in Oracle (you set some local settings only for "your" session). The reason is that I have tables with 20+ fields (at least 6 are in date format) and that will make huge Select statements.
  13. Hey guys, I have old MS SQL 2008 and a Query (FireDAC), that returns some fields in Date format. In a Delphi application all work great, it seems FireDac takes care to visualize Date to FormatSettings. However when I open a FastReport document, it seems it convert Date to a the PC local settings (different from my changes in FormatSettings). And that is not good, because on different machines, results could look differently. I wonder, is there a way, to force Dates in FastReport to be in my desired format regardless of the PC local? A possible solution, could be if I force the Query to return the desired format, I just wonder how?
  14. Squall_FF8

    Delphi Mystery: Edit vs Action

    Hmm are you suggesting, that because Main is the owner of the 2 windows (and the Edit), the Actions have higher precedence? (and thus difference in behavior)
×