Answered by:
Error message: 'CHR' is not a recognized built-in function name

Question
-
Hi
I am using SQL server 2008R.
When I run a spesific *.abs file, I get this error message:
'CHR' is not a recognized built-in function name
Anyone know how I can fix the problem
Friday, August 9, 2013 12:36 PM
Answers
-
The scripting language appears to be VBScript. And the SQL appears to be Oracle SQL. The '||' operator and 'CHR' function are in Oracle SQL. In TSQL '+' is the concatenation operator and CHAR() is the name of the function.
David
David http://blogs.msdn.com/b/dbrowne/
- Proposed as answer by Olaf HelperMVP Saturday, August 10, 2013 11:00 PM
- Marked as answer by TiborKMVP Sunday, August 11, 2013 2:38 PM
Friday, August 9, 2013 2:30 PM
All replies
-
When I run a spesific *.abs file, I get this error message:
Hello,
What for a "*.abs" file do you mean, I don't know such a file extention?
Can you please explain more detailed, what you are doing, what the *.abs file contains and so one?
And SQL Server there is no CHR function, only a CHAR function to convert ASCII code into a char.
Olaf Helper
[ Blog] [ Xing] [ MVP]Friday, August 9, 2013 12:39 PM -
Hi
The name *.abs file is probably a local named file extension.
What the file does is just to get data from the database and present it in a txt file, in a spesific order.
Friday, August 9, 2013 12:49 PM -
Can you include the T-SQL code that is getting executed from (or as a result of) the .abs file? Basically it sounds like there is some sort of code being generated or executed that has a syntax error. Olaf's guess of CHR vs. CHAR would be an example of the syntax error that is being generated and would be a quick fix.
Thanks,
Sam Lester (MSFT)
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.Friday, August 9, 2013 12:52 PM -
Hi
The strange thing is that I have another computer where I have installed SQL server 2008R. Here the file/script works fine.
Do you mean I should replace CHR with CHAR in the script?
Friday, August 9, 2013 12:58 PM -
-
We can't really give a good suggestion on what to fix without seeing the script that is being executed. Can you post the script? What happens if you try to run the script directly on the machine through SSMS as opposed to going through the .abs file?
Thanks,
Sam Lester (MSFT)
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.Friday, August 9, 2013 1:04 PM -
Hi
I can send you the script. How do I do that?
Friday, August 9, 2013 1:08 PM -
If it is a very large script, my suggestion would be to search the script for the CHR string that is causing the problem and post the section containing this. Or pull the script out and run it in SSMS and work through any issues there using the errors returned by the engine.
Thanks,
Sam Lester (MSFT)
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.Friday, August 9, 2013 1:55 PM -
Hi
The Chr shows up in the script in two places
1)
Const CRLF = Chr$(13) & Chr$(10)2)
sSqlStatement = "SELECT INVOICE.CONTACT_ID_SEND_TO, " & _
"INVOICE.DATE_EXPECTED_REC, " & _
"INVOICE.INVOICE_ID, " & _
"REPLACE(INVOICE.DESCRIPTION,CHR(13)||CHR(10),' ') INVDESC, " & _
"COST_TRAN.COST_CAT_ID, " & _
"REPLACE(COST_TRAN.DESCRIPTION,CHR(13)||CHR(10),' ') COSTDESC, " & _
"COST_TRAN.AMOUNT_INCOME AMOUNT_INCOME, " & _
"COST_TRAN.PR_ID, " & _
"INVOICE.STATUS, " & _
"LS.LS_ID, LS.BL_ID, BL.ADDRESS1 " & _
"FROM INVOICE,COST_TRAN,LS,BL " & _
"WHERE INVOICE.INVOICE_ID = COST_TRAN.INVOICE_ID "& _
"AND COST_TRAN.LS_ID = LS.LS_ID "& _
"AND COST_TRAN.BL_ID = BL.BL_ID "& _
"AND LS.BL_ID = BL.BL_ID "& _
"AND INVOICE.STATUS = 'ISSUED' "& _
"ORDER BY INVOICE.LS_ID, INVOICE.BL_ID, INVOICE.INVOICE_ID"can this be of any help in solving the problem
Friday, August 9, 2013 2:04 PM -
Hi
Have to go. I'll be back on monday
Regards
DagFriday, August 9, 2013 2:22 PM -
The scripting language appears to be VBScript. And the SQL appears to be Oracle SQL. The '||' operator and 'CHR' function are in Oracle SQL. In TSQL '+' is the concatenation operator and CHAR() is the name of the function.
David
David http://blogs.msdn.com/b/dbrowne/
- Proposed as answer by Olaf HelperMVP Saturday, August 10, 2013 11:00 PM
- Marked as answer by TiborKMVP Sunday, August 11, 2013 2:38 PM
Friday, August 9, 2013 2:30 PM -
Hi
Thank you for your help. Found the error.
You are right. It was first made in Oracle SQL, and later changed to MSSQL.The file I had was an earlier version. I had it mixed up with the final version.
My fault.Regards
DagSaturday, August 10, 2013 3:26 PM