Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scope_identity() not working inside VFP transaction
Message
 
To
17/06/2011 18:17:20
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01515025
Message ID:
01515029
Views:
52
Charles, I think is better to grab the PK in the same command as the insert with the OUTPUT clause of the insert. Something like
text to lcSQL textmerge noshow flags 1 pretext 1 + 2 + 4
	INSERT INTO yourTable
		(	
			yourFieldList
		)
	OUTPUT Inserted.yourPrimaryKey
	VALUES
		(
			yourValuesList
		)
endtext
llSuccess	= Sqlexec(lnConnection, lcSQL, 'c_pk') = 1
lnNewPK		= Iif(not llSuccess or Eof('c_pk') or c_pk.pk = 0, null, c_pk.pk) && Assuming PK is your primary key field name
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform