SQL Server 2005 Error

General discussion forum about all databases other than SqlBase.
matelix

SQL Server 2005 Error

Post by matelix » 16 Feb 2010, 09:52

Hi all.

I recently upgrade my server from MS SQL SERVER 2000 to MS SQL SERVER 2005. I got the databases and schemas to work perfectly. So my database is setup correctly. However, i'm now going through my application to see if my code is SQL 2005 compatible. 80% works perfectly. The rest, I can figure out what I need to change. But there is a certain statement that I just can't figure out.

When I try to populate a table, I get the following error:

[Microsoft][ODBC SQL Server Driver][SQL Server]Could not find prepared statement with handle 6
OR
[Microsoft][ODBC SQL Server Driver][SQL Server]Could not find prepared statement with handle 12
OR
[Microsoft][ODBC SQL Server Driver][SQL Server]Could not find prepared statement with handle 5 etc.

The handle number changes every time I change something in the statement. My code looks like this:

Call SalTblPopulate([TABLE],hSql,'Select * from a,b,c,d,e,f
where rtrim(a.doc_no) = rtrim(b.doc_no)
and rtrim(c.cust_code) = rtrim(d.code)
and rtrim(a.code) *= rtrim(d.code)
and rtrim(c.categ) *= rtrim(d.categ)
and rtrim(a.doc_no) = [VARIABLE NAME]
and rtrim(d.cat_type) = [TEXT] ',TBL_FillAll)

Besides the obvious of fixing the statement and using proper joins, there seems to be and even bigger problem because even if I populate the table with data straight from the database without using any joins, it still gives me the same error/s. I even tried to use a SalSqlImmediate() function to select the data and store it in variables instead because I thought maybe it's my populate statement that's wrong, but even that doesn't work. The weird thing is that if I run this query in the SQL Query Analyzer itself, it executes perfectly with no errors whatsoever. It will fetch all the correct data. Is it something that i'm doing wrong? Or is there a better way of executing this query without getting the error.

I tried looking it up on the Microsoft forums, but they could only support ADO developers. They released a patch for ADO that fixes the problem. Is there something similar for TD?

Software: TD 4.1
Server: Microsoft SQL Server 2005

Thanks in advance,
Matelix

FRBhote
India
Posts: 2203
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: SQL Server 2005 Error

Post by FRBhote » 16 Feb 2010, 13:20

Is there any sql statement executed in the SAM_FetchRow?

matelix

Re: SQL Server 2005 Error

Post by matelix » 18 Feb 2010, 11:25

No, not at all. Should I have a Sql statement in there? :?

leeroyc
Australia
Posts: 2
Joined: 13 Nov 2018, 09:34
Location: Australia

Re: SQL Server 2005 Error

Post by leeroyc » 14 May 2010, 03:56

Hi,

I have noticed that Centura connecting to SQL Server has difficulty with Outer Joins the easiest way around this is to create this in a stored procedure using a temp table thus avoiding outer joins.

If you need help in how to populate a table window from a stored procedure drop us an email :D

FRBhote
India
Posts: 2203
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: SQL Server 2005 Error

Post by FRBhote » 14 May 2010, 06:12

I too had problems with outer joins, but once the Sql Server service pack was installed it became ok.

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 4 guests