Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Capturing the output clause
Message
 
 
To
11/08/2009 14:41:05
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgia, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01417348
Message ID:
01417381
Views:
38
>I got the thing to work. It may not be the cleanest but it will suit my needs at this point. Basically what I am doing is including the statement "Output inserted.InvRecordNO" in the SQL. If the SQL succeeds then I call "=SQLEXEC(dbHandle,"Select * from inserted") " and then r=VAL(sqlresult.invRecordNo)" . This returns the new primary key to me. I hate to hit the database twice and think it very strange that SQL Server would return the integer invRecordNo as a character string.
>
>Thank you all for your help!

I'm not sure you're getting the correct result with this approach.

Did you try
text to lcInsert textmerge noshow
  declare ...
  insert into myTable ....
  select * from @Output
endtext

sqlexec(dbHandle, lcInsert,'curMyResult')
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform