While using SQL-SELECT to retrieve Tally data, we found that in certain cases, Tally Software returns incorrect results. This problem prima-facia appears to be a bug in Tally.
The BUG relating to SQL-SELECT statements
The SQL-SELECT statement in Tally returns incorrect result when some specific characters are used like period (a dot).
Steps to replicate the problem:-
Step 1
Create a new Company in Tally (we tested it with Tally 7.2, Tally 9 Release 2.14, Tally 9 Release 3 [Beta])
Step 2
Select option "Gateway of Tally >> F12 >> Accts / Inventory Info". Next, set the option "Use PART NUMBERS for Stock Items" to YES under the section "Inventory Masters"
Step 3
Next, create two Stock Items using option "Gateway of Tally >> Inventory Info >> Stock Items >> Create" as shown below:-
STOCKNAME PARTNUMBER
Cylinder 100
Cyl. Block 101
Step 4Try out the using following SQL-SELECT statement.
SELECT $Name,$AdditionalName FROM Ledger where $Name="Cylinder"Result:-
Correct. You get one record.
Step 5Next, try out the following SQL-SELECT statement.
SELECT $Name,$AdditionalName FROM Ledger where $Name="Cyl. Block"Result:-
Incorrect. There is no output even though the Stock-Item "Cyl. Block" exists in Tally.
Step 6 Next, try out the following SQL-SELECT statement.
SELECT $Name,$AdditionalName FROM Ledger where $Name="Cyl Block"Result:-
Correct. You get one record.
ConclusionCase 1 (refer Step 5)$Name="Cyl. Block" does not work even though the Stock Item exists in Tally. This is because we have used a dot (period) i.e (
Cyl. Block)
Case 2 (refer Step 6)$Name="Cyl Block" works fine and the query returns data.