Robert L. Stewart
rl_stewart at highstream.net
Fri Oct 1 11:52:20 CDT 2004
Susan, You should also not use the SELECT * for a union query. You should name the columns in both sides of the union making sure you order them correctly by matching data and data types. If someone changes the structure of one of the tables, your union, the way you are doing it, will stop working. SELECT NameID, LastName + ', ' + FirstName FROM tblEmployee UNION ALL SELECT CustID, CustName FROM tblCustomer as an example Robert At 09:33 AM 10/1/2004 -0500, you wrote: >Date: Thu, 30 Sep 2004 15:34:16 -0400 >From: "Klos, Susan" <Susan.Klos at fldoe.org> >Subject: [dba-SQLServer] Union query >To: "'dba-sqlserver at databaseadvisors.com'" > <dba-sqlserver at databaseadvisors.com> >Message-ID: > <01B619CB8F6C8C478EDAC39191AEC51EE738AD at DOESEFPEML02.EUS.FLDOE.INT> >Content-Type: text/plain > >Please be kind. I am doing this from an Access viewpoint and am having >trouble making a transition. > >I have created a union query: > >Select * > > >From dbo.schoolEnrollmentNumberselemonly (this is a view) > >Union all > >Select * > > >From dbo.SchoolEnrollmentNumberselemcombo (this is a view) > > > >Now I need to be able to call this query in another view. Is this possible? >How? > > > >Susan Klos