Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL returns -1
Message
From
24/05/2007 15:56:20
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQL returns -1
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01228299
Message ID:
01228299
Views:
61
I have this SP. When it does deletes the server returns -1 back to my apps.
The deletes go thru Ok, but the value returned is -1.

Any idea?



set ANSI_NULLS ON

set QUOTED_IDENTIFIER ON

GO

CREATE PROCEDURE [dbo].[usp_UpdateConsistPersonnel](@xmlstring TEXT)

AS

DECLARE @idoc int

--Create an internal representation of the XML document.

EXEC sp_xml_preparedocument @idoc OUTPUT, @xmlstring

CREATE TABLE #TempData (

id int,

header_id int,

person int,

name nchar (100),

worknum int)

INSERT #TempData

SELECT *

FROM OpenXML(@idoc, 'VFPData/datacursor', 1)

WITH (

[id] [int],

[header_id] [int],

[person] [int],

[name] [nchar] (100),

[worknum] [int])

-- update

update consistpersonnel set

[person] = t.person,

[name] = t.name,

[worknum] = t.worknum

from #TempData t

where consistpersonnel.id = t.id

-- insert

insert consistpersonnel

select

[header_id],

[person],

[name],

[worknum]

from #TempData t

where t.id = 0

-- delete

delete consistpersonnel

from #TempData t

where consistpersonnel.id = t.id

and t.header_id = -1

exec sp_xml_removedocument @idoc



Thanks
Next
Reply
Map
View

Click here to load this message in the networking platform