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 2000 Forums
 Transact-SQL (2000)
 SQL Server 2000 Database Name Variable

Author  Topic 

cjpsx
Starting Member

34 Posts

Posted - 2006-08-09 : 10:39:44
I'm frequently having to update database references in functions. I would like to set the database name as a variable so that I only have to update it once. Is this possible? I do not think synonyms are supported in SQL Server 2000.

Thanks,
cj

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-08-09 : 11:05:54
you have to use dynamic SQL. Check out exec() or sp_executesql in Books On Line.


KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-09 : 11:23:03

http://www.sommarskog.se/dynamic_sql.html


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -