
2nd SQL Server update after update text field corrupts row - using RDO
I've got a 6.5 sp2 database with a table containing many normal fields
and 3 textfields.
If I modify the normal fields using an UPDATE query, all goes well.
If I modify one of the text fields, the next time I run the stored
procedure I use to lock the record with my custom lock field (which
doesn't modify any memo fields), the row becomes corrupted. The
timestamp field becomes NULL and some keys end up with trash
characters.
This behavior only began after I added some text fields. I am at a
loss.
The code that I use to update the record (bill address is a text
field) looks like:
update tSite SET billAddress='xxxxafafadfadfadfafadf' ,revDate =
'3/19/97' ,lockUser = NULL,lockWs = NULL,lockTime = NULL where siteCtr
= 5 and tsequal(siteTs, convert(binary(8),
convert(money,429499.5888)))
which is called using code like:
Set ps = cn.CreatePreparedStatement("prSaveSite", sql)
ps.Execute
The stored procedure is as follows:
CREATE PROCEDURE prLockSite
)
as
from tSite
begin
raiserror (55000, 1,1)
return 1
end
begin
raiserror(55001, 1, 1)
return 1
end
UPDATE tSite
begin
from tSite
end
-- if there is an error in select, will return that or a
-- 0 for success
GO
I am calling the prLockSite procedure like:
Dim sql$
sql = "{ ? = call prLockSite (?, ?, ?, ?, ?) }"
'rdoEngine.rdoDefaultErrorThreshold = 16
Set ps = cn.CreatePreparedStatement("prLockSite", sql)
ps.rdoParameters(0).Direction = rdParamReturnValue
ps.rdoParameters(1) = siteCtr
ps.rdoParameters(2) = siteTs ' 429498.2278
ps.rdoParameters(3) = GetCurrentUser ' "userName"
ps.rdoParameters(4) = GetCurrentWs ' "wsName"
ps.rdoParameters(5).Direction = rdParamReturnValue
ps.Execute
How can I make my database work with these text fields? I don't
understand how SQL Server can corrupt a row. This sounds like a bug
to me. Are there some workarounds so that I can get text fields to
work?
--