You are here: Re: Idea: new database object that defines a FROM clause « MsSQL Server « IT news, forums, messages
Re: Idea: new database object that defines a FROM clause

Posted by John Rivers on 01/08/07 23:38

Thanks for your reply

CTEs, Views and Derived Tables

all require a SELECT clause

what I am trying to achieve is a reusable FROM clause





On Jan 7, 8:38 am, "David Portas"
<REMOVE_BEFORE_REPLYING_dpor...@acm.org> wrote:
> John Rivers wrote:
> > create from dbo.fromExample
> > as
> > from dbo.Customers c
> > join dbo.Invoices i
> > on c.CustomerID = i.CustomerID
>
> > now you can use it as follows:
>
> > select c.CustomerID, i.InvoiceNo
> > from dbo.fromExample
>
> > I find I reuse FROM clauses alot
>
> > and reusing a "base query" requires writing a very large and cumbersome
> > select clauseUse a CTE
> or a view
> or a derived table
>
> --
> David Portas, SQL Server MVP
>
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
>
> SQL Server Books Online:http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --- Hide quoted text -- Show quoted text -

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация