Click here to Skip to main content
16,009,156 members
Home / Discussions / Database
   

Database

 
GeneralRe: concat multi rows field Pin
Wendelius22-Nov-08 4:45
mentorWendelius22-Nov-08 4:45 
GeneralRe: concat multi rows field Pin
sepel22-Nov-08 5:21
sepel22-Nov-08 5:21 
QuestionSql bitwise in pervaisve DataBase Pin
Thaer Hamael22-Nov-08 2:19
Thaer Hamael22-Nov-08 2:19 
Questiondoubt in cross join Pin
deepthy.p.m21-Nov-08 22:01
deepthy.p.m21-Nov-08 22:01 
AnswerRe: doubt in cross join Pin
Mycroft Holmes21-Nov-08 23:26
professionalMycroft Holmes21-Nov-08 23:26 
GeneralRe: doubt in cross join Pin
deepthy.p.m23-Nov-08 17:48
deepthy.p.m23-Nov-08 17:48 
QuestionSql reporting Pin
member2721-Nov-08 20:25
member2721-Nov-08 20:25 
QuestionUDF's in Stored Procedures (not using)... Pin
Andy_L_J21-Nov-08 17:04
Andy_L_J21-Nov-08 17:04 
I have inherited some code that runs like a pig (I think because of numerous udf calls).

I am not yet sufficiently skilled at T-SQL to figure out how to fix this, maybe someone can give me a couple of pointers?

Structure:

5 Tables:

PType   ID   Name
PCat	ID   PTypeID   Name
Prod	ID   PCatID    Name
Prop	ID   PTypeID   Name
PropVal	ID   ProdID    PropID   Value

all ID's are Primary. All xxxID's are Foreign

In order to access PropVal Value data, the previous dev has used a udf to return the value.
This now means that heaps of sp's are littered with this function, causing what I believe are pretty serious
performance issues.

Example:

	SELECT p.Name, Case When pt.Name LIKE 'IN%'
		            Then dbo.fGetPropVal(p.Name.'SHOT')
			    Else 0
		       End As 'SHOT',
		       Case When pt.Name LIKE 'EX%'
			    Then dbo.fGetPropVal(p.Name,'LEN')
			    Else 0
		       End As 'LEN',
		...
	  FROM Prod p
	    JOIN PCat pc
	      ON p.PCatID = pc.ID,
	    JOIN PType pt
	      ON pc.PTypeID = pt.ID

       ...



	(udf - like...)
	
	SELECT Value 
	  FROM PropVal pv
	    JOIN Prop pr
	      ON pv.PropID = pr.ID
	    JOIN Prod p
	      ON pv.ProdID = p.ID
	    JOIN PCat pc
              ON p.PCatID = pc.ID
	   JOIN PType pt
	      ON pc.PTypeID = pt.ID
	  WHERE p.Name = @PName
	    AND pr.Name = @PropName


Is there much I can do with this?

Any advice or pointers in the right direction will be most appreciated.

I don't speak Idiot - please talk slowly and clearly

AnswerRe: UDF's in Stored Procedures (not using)... Pin
Wendelius21-Nov-08 23:15
mentorWendelius21-Nov-08 23:15 
AnswerRe: UDF's in Stored Procedures (not using)... Pin
Mycroft Holmes21-Nov-08 23:20
professionalMycroft Holmes21-Nov-08 23:20 
GeneralRe: UDF's in Stored Procedures (not using)... Pin
Wendelius21-Nov-08 23:58
mentorWendelius21-Nov-08 23:58 
GeneralRe: UDF's in Stored Procedures (not using)... Pin
Ben Fair25-Nov-08 4:16
Ben Fair25-Nov-08 4:16 
QuestionKeeping track of Pin
CodingYoshi21-Nov-08 9:16
CodingYoshi21-Nov-08 9:16 
AnswerRe: Keeping track of Pin
Mycroft Holmes21-Nov-08 13:06
professionalMycroft Holmes21-Nov-08 13:06 
AnswerFunction for Status Pin
David Mujica21-Nov-08 13:39
David Mujica21-Nov-08 13:39 
GeneralRe: Function for Status Pin
Mycroft Holmes21-Nov-08 23:12
professionalMycroft Holmes21-Nov-08 23:12 
AnswerRe: Keeping track of Pin
Wendelius21-Nov-08 23:43
mentorWendelius21-Nov-08 23:43 
Questionconvert from MSAccess to Oracle Pin
sajid.salim.khan21-Nov-08 5:46
sajid.salim.khan21-Nov-08 5:46 
AnswerRe: convert from MSAccess to Oracle Pin
David Mujica21-Nov-08 6:01
David Mujica21-Nov-08 6:01 
GeneralRe: convert from MSAccess to Oracle Pin
sajid.salim.khan21-Nov-08 6:15
sajid.salim.khan21-Nov-08 6:15 
QuestionImport excel to Sql server Pin
Abhilash121-Nov-08 3:02
Abhilash121-Nov-08 3:02 
AnswerRe: Import excel to Sql server Pin
indian14321-Nov-08 3:20
indian14321-Nov-08 3:20 
AnswerRe: Import excel to Sql server Pin
indian14321-Nov-08 8:23
indian14321-Nov-08 8:23 
AnswerRe: Import excel to Sql server Pin
Jerry Hammond21-Nov-08 14:06
Jerry Hammond21-Nov-08 14:06 
AnswerRe: Import excel to Sql server Pin
Wendelius21-Nov-08 22:19
mentorWendelius21-Nov-08 22:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.