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)
 Reusable blocks of code in stored procedures

Author  Topic 

oslotboom
Starting Member

1 Post

Posted - 2008-04-15 : 10:13:17
I have several stored procedures with a similar query. The SELECT clauses are identical, but the FROM and WHERE clauses are different.

Since the SELECT clause is long and complicated (and often changes), I want to place the SELECT clause in a separate file and then have the stored procedures include the block of text for the SELECT clause when they compile.

Is this possible? Looking through the docs and searching online, I don't see any way to do this.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-15 : 11:32:07
I think what you require are User Defined Functions where you can put your common code and them call them wherever you need to include them. But before that can you post your sample code so as to give us more idea on this.
Go to Top of Page
   

- Advertisement -