SQL Server and IDENTITY column

Grzegorz (Greg) Pasternak gpasternak at cogeco.ca
Fri Jan 18 10:13:43 EST 2019


Nick;

Thank you for your help, the code works fine and it does exactly what is needed.

Question to you:
"Is it better to instantiate new statement object of local scope inside $insert as opposed to using statement object of instance scope instantiated during $construct of the base table class?"

Greg

On Jan 17, 2019, at 5:43 PM, Nick Harris <nick at dataweaver.com> wrote:

> Greg
> Do $cinst.$extraquerytext.$assign('SELECT SCOPE_IDENTITY()') 
> Do ioSession.$newstatement() Returns loStatement 
> Begin statement
> Sta: {INSERT INTO [$cinst.$servertablenames]}
> Sta: {[$cinst.$insertnames()]}
> Sta: {[$cinst.$extraquerytext()]}
> End statement
> Do loStatement.$prepare() Returns lvMethodFlag
> Do loStatement.$execute() Returns lvMethodFlag
> Do loStatement.$fetchinto(lfvIdent) 
> Calculate $cinst.SEQ as lfvIdent
> Regards
> Nick
> 
> -----Original Message-----
> From: omnisdev-en [mailto:omnisdev-en-bounces at lists.omnis-dev.com] On Behalf
> Of Grzegorz (Greg) Pasternak
> Sent: Thursday, January 17, 2019 10:18 PM
> To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
> Subject: Re: SQL Server and IDENTITY column
> 
> I am sure this question has been asked before, I hope by now people know how
> to handle it best in Omnis.
> Is "SELECT @@IDENTITY" the answer?
> or .
> is there a better solution, perhaps using "SCOPE_IDENTITY" function?
> 
> Greg
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com Start a new
> message -> mailto:omnisdev-en at lists.omnis-dev.com 
> 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 




More information about the omnisdev-en mailing list