Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 View with Dynamic Databasen name

Author  Topic 

QAZAFI
Yak Posting Veteran

50 Posts

Posted - 2008-05-07 : 00:47:55
I got a situation in which I would like to create a Views which is using my Test database (Could use more then one test database), but when I test It I would like to create using my Production database (Which is different Database name). Is there any way so that I can pass a parameter at run time which hold a Database name and create those views using that parameter.
Any help really appreciated

Thanks in advance

pootle_flump

1064 Posts

Posted - 2008-05-07 : 05:24:25
Not a view no - you can do this with dynamic SQL or by duplicating the code. Why not have the view in your test environment and in your production environment and run the relevant one depending on the data you want?
Go to Top of Page

pootle_flump

1064 Posts

Posted - 2008-05-07 : 06:41:05
Actually - I've assumed this is eventually to be part of the prod deployment. Is this something different, for example some sort of admin view?
Go to Top of Page
   

- Advertisement -