Passing parameters to Teradata from MS SQL stored procedure


Passing parameters to Teradata from MS SQL stored procedure

// code snippet 1 - passing parameter to MS SQL stored procedure **************
CREATE PROCEDURE Param_test1 @Param1 as Varchar(2) = NULL
  FROM Table1
WHERE col1 = ISNULL(@Param1,'17')

// code snippet 2 - MS SQL function as Teradata query **************
CREATE FUNCTION Teradata_query1()
 FROM OPENQUERY(Teradatalink,
 'select COLUMN1,
  COLUMN2                                ,
  from TERADATA_TABLE1                            
  where (COLUMN1 = ''17'')') Rowset_1)

// code snippet 3 - call to Teradata query in MS SQL stored procedure **************
Select * into MSSQL_Table1
From Teradata_query1()

I have a MS SQL stored procedure which calls Teradata query via ODBC link. I would like to modify the Teradata query to accept parameters from the MS SQL stored procedure. I know that I can code a MS SQL stored procedure to accept a parm or use default  value as in the code snippet 1 above. The Teradata queryfunction (code snippet 2) is called from my MS SQL stored procedure as in code snippet 3. How can I modify code in snippets 2 and 3 to pass a parameter to the Teradata query to replace the hardcoded value "17" with a passed parameter volume?