Grabbing and storing Details from a SQL Server

lukeliwanaglukeliwanag Posts: 28

Hi Everyone,
I have a few different scenarios. They do not happen at the same time a request comes in.

  1. I just want to ask how can we grab some values from SQL server and use it to send to the xml response

  2. How do i generate a time stamp in this format "2015-12-18T19:44:18.103" and store it on the SQL Server.

Comments

  • jakubiakjakubiak Posts: 215 ✭✭✭

    You can use a DB Tool to make a query to your SQL Server, and then attach an XML data bank to store the values into a Writable data source or into a variable that can be used in your responder.

    To generate the timestamp, you can use the Date Math tool from the Parasoft Marketplace. You can attach an Text Data Bank to it to store the value into a variable that can then be used in a query using the DB Tool.

  • lukeliwanaglukeliwanag Posts: 28

    @jakubiak thank you for your reply.

    How do i do this approach? once i execute this sample SQL query:
    "Select column1, column2 from mytable where column1=returns 1 row", what code should i write in order for me to:
    xmlDatabankVariable1 = column1. value
    etc?

  • jakubiakjakubiak Posts: 215 ✭✭✭

    Right-click on the DB Tool that contains that SQL query and choose "Add Output". Then add an XML Data Bank to the "Results as XML" output. This will cause the result set that gets returned by the SQL query to be converted into an XML document. The XML Data Bank will then save the values you care about from the XML Document.

Sign In or Register to comment.