Sometimes we need flexibility of using dynamic database name(s) in PL/SQL Statements. We might have an application where the database(s) are given an option in the drop downbox and the user can select any one. Based on the selection, another drop downbox shows all the tables in that database. In order to achieve the same, dynamic execution of sql statements can be used in SQL Server: declare @vDatabasename varchar (5 0 ) set @vDatabasename = 'Example' EXEC ( 'Select * from [' + @vDatabasename + '].sys.Tables' )