ads/auto.txt

Declare Result Set Sql

Declare Result Set Sql. It could result in a one row one column output or a 100 column million row output. Select Top1ModelID modelid from models where areaid South Coast.

Dynamic Sql In Sql Server
Dynamic Sql In Sql Server from www.sqlshack.com

Declare ModelID uniqueidentifer Set ModelID select Top1 modelid from models where areaid South Coast Another way. To assign a value to a variable use the SET statement. Because the value requested for CustomerID does not exist the subquery returns no value and the variable is set to NULL-- Uses AdventureWorks DECLARE var1 VARCHAR30 SELECT var1 Generic Name SELECT var1 SELECT Name FROM SalesStore WHERE CustomerID 1000 SELECT var1 AS Company Name.

Either way thats a result set.

There are three options. The parameter ID isnt passed to the SP it is built into the sqlCommand as text and then executed. For each result set you need an SQLDA big enough to hold descriptions of all columns in the result set. You can use this but remember that your query gives 1 result multiple results will throw the exception.