|
|
•
DS view problems on new server
Replies:
10
Views:
8463
Up one level
You need to be a registered member to post to this forum.
Register now.
| |
|
|
•
DS view problems on new server
Posted by
kbrown
at
2005-01-03 01:37 PM
After
moving DataSplice to a new server we had problems inserting records in several
views. Jeff Gibson helped me fix several views by adding a parameter value for
@p_user, but I'm still having problems with two
views, one of which was discussed with Jeff. I'm sending the views to Jeff as
e-mail attachments.
We're
using SQL Server 2000 and DSAdmin version 2.1.3.
The
view I worked with Jeff on last week was JOB PLANS. I created a new view,
copied the SQL statement from the old one, and deleted the old one. It works
fine in preview, but nothing is displayed in the DS client. This is a read-only
view that isn't as important as the other view that's not working.
The other problematic view is WORK ORDER LD, which works fine for updating an
existing record but not for inserting. The
error message is "Error inserting record: Before procedure 1 failed."
The error message
details are
View Name: WORK ORDER LD
Source File: DBProcedure.cpp
Source Line: 265
Procedure: func_ds_setldkey
SQL Statement: {call func_ds_setldkey(?, ?, ?)}
Details: Error executing statement
State 1: 22001
Native Error 1: 8152
ODBC Message 1:String or binary data would be truncated.
State 2: 01000
Native Error 2: 3621
ODBC Message 2:The statement has been terminated.
The
SQL statement is:
select w.wonum, w.ldkey, ld.ldownertable, ld.ldownercol, ld.ldtext
from workorder w, longdescription ld
where w.ldkey = ld.ldkey and ld.ldownertable = 'WORKORDER'
The
primary keys are: w.ldkey, ld.ldownertable,
ld.ldownercol
The
parameters for func_ds_setldkey are:
|
Param Name
|
Data
Type
|
Param Value
|
Column
Type
|
|
@p_table
|
SQL_VARCHAR
|
${LDTable}
|
Input
|
|
@p_keyvalue
|
SQL_VARCHAR
|
${WO
Num}
|
Input
|
|
@p_ldkey
|
SQL_INTEGER
|
${LDKey}
|
Input
|
|
| |
|
|
•
Re: DS view problems on new server
Posted by
kunzem
at
2005-01-03 02:12 PM
Job Plans:
Does the view use any query attributes in a default or mandatory criteria? If so, perhaps this is hiding data from the user because it evaluates differently than in the admin client. Also, how are you connecting to the database? If the 'User DB Connection' setting is checked, then perhaps the user does not have permission to view the data in question.
Work Order LD:
What is the value of the ${LDTable} attribute in this case? It looks like one of the two parameters p_table or p_keyvalue is getting truncated, which doesn't make much sense. How are the fields defined in the underlying database?
|
| |
|
|
•
Re: DS view problems on new server
Posted by
kunzem
at
2005-01-03 03:36 PM
Whoops - ignore the comments about the Job Plans view. I didn't notice the version you are using, which doesn't support the features I was talking about.
Can you give me some more details about what is happening on the client? Does the view show up, but simply not contain any records? Are there any error messages?
Jeff just sent me copies of the views, so I'll see if I can recreate the problem.
|
| |
|
|
•
Re: DS view problems on new server
Posted by
kbrown
at
2005-01-11 06:36 PM
We've discovered another problem, this time with the LABOR view. If the work order status is DEFER (a status code added fairly recently and not used much yet), we can't save a new labor record. The parameter values all look OK to me. If we change to a different status it works fine.
Job Plans are working fine now, but Work Order LD is not.
-------------------------------------------
For the LABOR view, the error message is -
Error inserting record: Before procedure 0 failed
View Name: LABOR Source File: DBProcedure.cpp Source Line: 265 Procedure: proc_dsinsertlabor SQL Statement: {call proc_dsinsertlabor(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)} Details: Error executing statement State 1: 37000 Native Error 1: 50000 ODBC Message 1:Invalid WONUM. 0000115475 must have a valid status.
-------------------------------------------
This excerpt from PROC_DSINSERTLABOR is the only place that error message is generated -
-- validate wonum
select
@wo_eqnum = eqnum,
@wo_glaccount = glaccount,
@wo_location = location,
@wo_woeq10 = woeq10,
@wo_woeq11 = woeq11,
@wo_woeq12 = woeq12
from workorder
where wonum = upper(@p_wonum) and
status not in (select value from valuelist
where maxvalue in ('COMP', 'CAN', 'CLOSE'))
if @@ERROR != 0
begin
raiserror('Invalid WONUM. %s must have a valid status.', 16, 1, @p_wonum)
rollback transaction
return
end
-------------------------------------------
Here's the row in the valuelist table -
listname value maxvalue valdesc defaults type rowstamp
WOSTATUS DEFER WAPPR Deferred N 4
|
| |
|
|
•
Re: DS view problems on new server
Posted by
kbrown
at
2005-01-11 06:47 PM
Now I see what the LABOR problem is. The procedure I quoted was the one on the CD, but the procedure in use had the where clause changed to:
"where wonum = upper(@p_wonum) and status not in (select value from valuelist where maxvalue in ('WAPPR', 'CAN', 'CLOSE'))"
|
| |
|
|
•
Re: DS view problems on new server
Posted by
kunzem
at
2005-01-12 09:36 AM
That would definately explain it. Are you still having problems with the long description view?
|
| |
|
|
•
Re: DS view problems on new server
Posted by
kunzem
at
2005-01-12 04:27 PM
Ok, so I looked at the func_ds_setldkey code and have a few ideas. As far as I can tell, the only statement that could modify anything, and thus generate the truncate error, is:
-- update the workorder record with the new ldkey
update workorder set ldkey = @p_ldkey,
changedate = getdate(),
changeby = upper(SYSTEM_USER)
where wonum = upper(@p_keyvalue)
Furthermore, the changeby field is the only text field that might be causing the error. This raises a couple of questions:
- Do we know the value of
SYSTEM_USER at this point?
- What is the column definition of
changeby in the workorder table?
- Does commenting out the line that updates
changeby cause the error to go away?
Hopefully you can just modify the changeby field to be wide enough to accept the user name.
|
| |
|
|
•
Re: DS view problems on new server
Posted by
kbrown
at
2005-01-13 06:03 PM
The column definition for changeby is 18, and if I comment out that line the error goes away. The following also works and I’m leaving it this way for now:
changeby = upper(rtrim(substring((SYSTEM_USER), 1, 18 )))
(If I don't put a space between the 18 and the closing parenthesis above, the 8 ) gets converted to an untended smiley: )
SYSTEM_USER is “NT AUTHORITY\SYSTEM”, but I wish it wasn’t. When I was modifying the @p_user parameter for other procedures, if I picked something from the drop-down and the user didn’t enter anything in that field, DataSplice put “NT AUTHORITY\SYSTEM” in that field. On the old server it would have been “MAXIMO”. I assume this is because the ODBC data source on the old server used SQL Server authentication and the new server uses Windows authentication.
With all the copious notes I wrote about setting things up on the new server, I didn’t document why I used the different authentication method. Do you have any recommendations for authentication method? I’m thinking of changing that line to read, “changeby = ‘DATASPLICE’” since that’s more meaningful than either of the SYSTEM_USER values.
|
| |
|
|
•
Re: DS view problems on new server
Posted by
kunzem
at
2005-01-14 09:58 AM
Maybe the best solution is to not hardcode the value at all and instead add another parameter to the function. This would allow you to control the value passed in with the admin client.
Then you could set the value to 'DataSplice', or even better yet ${DS_USER}, which will be the name of the user logged in with DataSplice.
|
| |
|
|
•
Re: DS view problems on new server
Posted by
kbrown
at
2005-01-14 11:24 AM
Sounds like a good idea. Am I correct in assuming that if I add the parameter to the stored procedure it will appear in DS Admin Client after I click Update?
|
| |
|
|
•
Re: DS view problems on new server
Posted by
kunzem
at
2005-01-14 11:34 AM
Sounds like a good idea. Am I correct in assuming that if I add the parameter to the stored procedure it will appear in DS Admin Client after I click Update?
Yes, that should work.
|
| |
|