Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 6th, 2007, 10:26 AM
Friend of Wrox
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default Go for View or User Defined function

Hi Everybody!!,

Go for View or User Defined function

I am using 12-14 unions to get the desired output.

e.g ProductShipped is devided into four regions(North,south,east,west)

to get records of each regions i have to make 4 unions .

so i put 4 different function fn_getProductNorth,fn_getProductSouth,fn_getProduc tEast and

I could make one function and based on regions i could get the results.

the problem is that database is designed columnwise for each Region
i.e NorthRegion, SouthRegion,WestRegion and EastRegion are columns.
the same thing is applied for all other ProductOwner tables.

so I have to use joined on different columnName as specified by Regions.
Yes we can design good database tables but we can't modify it as per some business rules.
so ,
1>should i use View and put all the joins with Union Class.
2>should i continue with different function<for code maintainablity and reuse>
and then make union of all the functions
3>since we are only looking for records search,should i use view or function.
As i can get the results from both view and functions.

Because Admin can get records for all regions or some specific regions.
and these regions are different columns

NOrthRegion SouthRegion EastRegion
 1 1 1
 1 0 1
 0 1 0
 1 0 1

Any Help or pointer to use view or function?

Thanks In Advance.

Cheers :)

Cheers :)

Old December 12th, 2007, 05:18 AM
Friend of Wrox
Join Date: May 2006
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts

I think you should use FUNCTION with four parameters, one for each region.

Similar Threads
Thread Thread Starter Forum Replies Last Post
User Defined function in XSL1.0 elayaraja.s XML 1 July 22nd, 2008 03:24 AM
calling the user defined function on click event CsharpHelp C# 1 June 6th, 2005 07:25 AM
Calling User Defined Function penta Access 5 March 4th, 2005 12:57 PM
User Defined Function niravp SQL Server 2000 7 November 29th, 2004 02:18 PM
Using a user defined type and the Split Function nikotromus Access VBA 2 August 20th, 2004 12:02 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.