microsoft newsgroup web access
     dot net    |    ms sql    |    ms access    |    office    |    windows    |   
Microsoft ms sql group
sqlserver.ce
sqlserver.clients
sqlserver.clustering
sqlserver.connect
sqlserver.datawarehouse
sqlserver.dts
sqlserver.fulltext
sqlserver.msde
sqlserver.mseq
sqlserver.notificationsvcs
sqlserver.odbc
sqlserver.olap
sqlserver.programming
sqlserver.replication
sqlserver.reportingsvcs
sqlserver.security
sqlserver.server
sqlserver.setup
sqlserver.tools
sqlserver.xml
  
    

Dynamic SQL Question....



Hi all,
I'm building a stored procedure that takes a few input parameters where each
of the parameters represent columns from different tables in the database.
The parameter's can be null or populated. I can build the WHERE clause of
the SELECT statement dynamically, not a problem.

The question is how do I build the FROM clause to join the right tables? Do
I include all the tables as if I was evaluating all the input parameters?

-THanks! Dave

220 500625
Reply-To: "dfate"
From: "dfate"
Subject: Dynamic SQL Question....
Date: Fri, 14 Jan 2005 13:05:10 -0500
Lines: 12
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
Message-ID:
Newsgroups: microsoft.public.sqlserver.programming
NNTP-Posting-Host: 12.0.170.2
Path: TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.programming:500625

Hi all,
I'm building a stored procedure that takes a few input parameters where each
of the parameters represent columns from different tables in the database.
The parameter's can be null or populated. I can build the WHERE clause of
the SELECT statement dynamically, not a problem.

The question is how do I build the FROM clause to join the right tables? Do
I include all the tables as if I was evaluating all the input parameters?

-THanks! Dave



Fri, 14 Jan 2005 13:05:10 -0500 "dfate"

RE: Dynamic SQL Question....



Dynamic Search Conditions in T-SQL
http://www.sommarskog.se/dyn-search.html

The Curse and Blessings of Dynamic SQL
http://www.sommarskog.se/dynamic_sql.html



AMB


"dfate" wrote:

> Hi all,
> I'm building a stored procedure that takes a few input parameters where each
> of the parameters represent columns from different tables in the database.
> The parameter's can be null or populated. I can build the WHERE clause of
> the SELECT statemen


Fri, 14 Jan 2005 10:15:02 -0800 "=?Utf-8?B?QWxlamFuZHJvIE1lc2E=?="


COPYRIGHT © 2004, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE
http://www.meetholland.com

advertisement:   complete list of microsoft newsgroup    |    uk based newsgroup    |