SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Reusable blocks of code in stored procedures
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

oslotboom
Starting Member

1 Posts

Posted - 04/15/2008 :  10:13:17  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 04/15/2008 :  11:32:07  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000