Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

DB calls

LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest
writing to a data source
I have a sql insert that works fine.

I need to capture into a data source the IDENTITY of the entry, to be used later in a test.

i need to do this roughly 12 times.

What is the best type of data source to do this?

$[Ident: MSG_ID] = SELECT SCOPE_IDENTITY() Doesn't work.
Can I use more than one data source for each DBtool test?
If not, I suppose I could use a TABLE and use separate columns.

Can someone please provide a simple example,
of how to get
$[Ident: MSG_ID] = SELECT SCOPE_IDENTITY()
or

@IDENTITY

@IDENTITY is deprecated.

thanks!


Tagged:

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    If SELECT SCOPE_IDENTITY() returns a result set you should be able to chain an XML Data Bank to the DB tool and then extract the value you need into the data bank, whereas you should be able to utilize that value in a latter test. But you cannot assign a value to a data source column.
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    If called in the DB it will, i.e. SQL SERVER 2005.

    I wonder if SOA Test initiates a separate connection per query.
    SELECT SCOPE_IDENTITY returns null when called by itself.

    If I place the query at the end of an INSERT, it executes but returns null.

    If SELECT SCOPE_IDENTITY() returns a result set you should be able to chain an XML Data Bank to the DB tool and then extract the value you need into the data bank, whereas you should be able to utilize that value in a latter test. But you cannot assign a value to a data source column.

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    The default behavior is to create a new connection for each query. This can be changed by unchecking Close Connection checkbox. This forces it to reuse an existing connection, if any.

    If called in the DB it will, i.e. SQL SERVER 2005.

    I wonder if SOA Test initiates a separate connection per query.
    SELECT SCOPE_IDENTITY returns null when called by itself.

    If I place the query at the end of an INSERT, it executes but returns null.

    If SELECT SCOPE_IDENTITY() returns a result set you should be able to chain an XML Data Bank to the DB tool and then extract the value you need into the data bank, whereas you should be able to utilize that value in a latter test. But you cannot assign a value to a data source column.

Tagged