Work around for dynamic SQL  
Author Message
expjwt





PostPosted: Wed Jul 28 09:03:18 CDT 2004 Top

SQL Server Developer >> Work around for dynamic SQL

Hi All,

I have the following requirement - in a listing page , the user can specify / configure the columns he can view . For this.

1. the columns (as it exists in teh DB) are stored in a Table.
2. I need to now select these columns (the fields are mapped in a view).

Other than forming a dynamic SQL and executing using EXEC within a SP are there any other options to handle this scenario.

Thanks for your help in advance
Anu

SQL Server64  
 
 
Uri





PostPosted: Wed Jul 28 09:03:18 CDT 2004 Top

SQL Server Developer >> Work around for dynamic SQL Anuradha
Use sp_executesql
For more details please refer to the BOL


> Hi All,
>
> I have the following requirement - in a listing page , the user can
specify / configure the columns he can view . For this.
>
> 1. the columns (as it exists in teh DB) are stored in a Table.
> 2. I need to now select these columns (the fields are mapped in a view).
>
> Other than forming a dynamic SQL and executing using EXEC within a SP are
there any other options to handle this scenario.
>
> Thanks for your help in advance
> Anu


 
 
Roji





PostPosted: Wed Jul 28 08:12:17 CDT 2004 Top

SQL Server Developer >> Work around for dynamic SQL I think that its better to implement the column selection logic in the front
end.

--
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com




> Hi All,
>
> I have the following requirement - in a listing page , the user can
specify / configure the columns he can view . For this.
>
> 1. the columns (as it exists in teh DB) are stored in a Table.
> 2. I need to now select these columns (the fields are mapped in a view).
>
> Other than forming a dynamic SQL and executing using EXEC within a SP are
there any other options to handle this scenario.
>
> Thanks for your help in advance
> Anu