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.
| Author |
Topic |
|
dineshrajan_it
Posting Yak Master
217 Posts |
Posted - 2010-02-12 : 00:01:20
|
| Hi,i have four large tables and i have used union all for them and assigned them to views. is it a good approach. any better ways of doing it.Iam a slow walker but i never walk back |
|
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2010-02-12 : 00:38:40
|
Depends on the query, how often it will be used, and what you're looking to accomplish.In most cases a view is a good approach anytime you will be referancing a query often or from differant procedures/functions. Success is 10% Intelligence, 70% Determination, and 22% Stupidity.\_/ _/ _/\_/ _/\_/ _/ _/- 881 |
 |
|
|
dineshrajan_it
Posting Yak Master
217 Posts |
Posted - 2010-02-12 : 00:49:41
|
| Hi,The view contains four tables with million of rows. i just have to populate the documents from table with similar columns, datatype for a particular useridCREATE VIEW [dbo].[HealthCareTeamDocumentSharingView] AS--Gets Medical History Details SELECT [PrimId]= MedicalHistoryId,[UserId]=CreatedBy ,[Title]=TxTitle,[DocumentTypeId]=3,[TakenDate]=TreatmentDate FROM [dbo].USHR_MedicalHistory UNION ALL--Gets Dental History Details SELECT [PrimId]=DentalHistoryId,[UserId]=CreatedBy, [Title]=TxTitle,[DocumentTypeId]=4,[TakenDate]=TreatmentDate FROM [dbo].USHR_DentalHistory UNION ALL--Gets Laboratory Details SELECT [PrimId]=LabId,[UserId]=CreatedBy,[Title]=LaboratoryName,[DocumentTypeId]=2,[TakenDate]=DateLabWasTaken FROM [dbo].USHR_Laboratory UNION ALL--Gets Medication Details SELECT [PrimId]=MedicationId,[UserId]=CreatedBy,[Title]=MedicationNameId,[DocumentTypeId]=1,[TakenDate]=DateStarted FROM [dbo].USHR_Medications UNION ALL--Gets Imaging Details SELECT [PrimId]=ImagingId,[UserId]=CreatedBy,[Title]=ImagingDescription,[DocumentTypeId]=5,[TakenDate]=ImageTakenDate FROM [dbo].USHR_Imagingany other suugestionsIam a slow walker but i never walk back |
 |
|
|
|
|
|
|
|