Hi Naomi. Many thanks for replying
>>>>Do you want to pass a name of the parenttable or the table itself?
Not sure.... In effect I want to pass the 'Data' in, so not sure If I just need to pas the Name of the Table or the data..... I presume the data as I will need to use it in the Select inside of the stored procedure as the Table will not exist in the database.... it is being derived in a different way, based on resonses from a user
Regards,
Gerard
>>Hi.
>>I want to pass a Table of Primary keys to a stored procedure, with the intention of selecting out ALL children related to All the Rows passed into the SP.
>>Something Like following in Stored Procedure:
>>
>>
>>Select * from @ParentTable join ChildTable on ParetPK = ChildFK
>>
>>
>>Just wondering is it possible to pass the ParentTable as a parameter to the Stored Procedure. Code examples would be appreciated
>>The ParentTable is the Parameter I want to Pass in
>>ChildTable is a SqlServer Table in a database
>>
>>Tia
>>Gerard
>
>Do you want to pass a name of the parenttable or the table itself?
>
>If you're using SQL Server 2008 and up, you can pass table-valued parameter.
>
>If you want to just pass the name of the table, then you would need to use dynamic SQL.
>
>Assuming the former, check
>
http://blog.sqlauthority.com/2011/08/25/sql-server-tips-from-the-sql-joes-2-pros-development-series-table-valued-store-procedure-parameters-day-25-of-35/>
>for usage explanation from the SQL Server side.