Procedure to Get Multiple Dataset as a Result Using a Stored Procedure


CREATE PROCEDURE MultipLeDataset
AS
BEGIN
DECLARE @IntVariable int;
DECLARE @SQLString1 nvarchar(500);
DECLARE @SQLString2 nvarchar(500);
DECLARE @ParmDefinition nvarchar(500);

/* Build the SQL string one time.*/

SET @SQLString1 =
     N'SELECT AccountKey, ParentAccountKey, AccountCodeAlternateKey, ParentAccountCodeAlternateKey
       FROM AdventureWorksDW.dbo.DimAccount';
      
SET @SQLString2 =
     N'SELECT CurrencyKey, CurrencyAlternateKey, CurrencyName
       FROM AdventureWorksDW.dbo.DimCurrency';
     
/* Execute the string with the first parameter value. */

EXECUTE sp_executesql @SQLString1;
EXECUTE sp_executesql @SQLString2;

END

Comments

Popular posts from this blog

SSIS vs. T-SQL

Sync SSAS Cube From One Environment to Another

SQL Function to replace special characters from a string