If you've only got one other database then I'd suggest you automatically generate the proc's at deployment or some similar choice.sql
2012年3月20日星期二
Any way to parameterize a database reference?
I need to refer to a second database from within the database that I login to. Can any one help me with how to abstract this reference? I would like to be able to change a parameter somewhere (i don't really care where) and have it effect any Stored Porcedure which references the second database.You could use the OpenQuery syntax or sp_execute <command>, you could even automatically update a link server - a bit extreme. However, I hate all those options. Stored procedure are at their best when they know about the tables they need to use. Introducing unknowns is not a great idea.
订阅:
博文评论 (Atom)
没有评论:
发表评论