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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 HELP!!! Please read :)

Author  Topic 

yirmyah
Starting Member

2 Posts

Posted - 2007-03-27 : 19:13:38
Hi,

Currently I have a stored procedure that uses one input parameter. It returns several output parameters. Depending on the value of the input parameter, it may go through 1 of 7 'If' conditions.

so for example,

If parameter1 = A then
If parameter2 > 1 then
-code
If parameter2 = 1 then
-code
Endif
If parameter1 = N then
-etc

What I would like to do is to create a fact table which uses the input parameter to build it. I have tested that sequential data updates of this will take about 6 days to complete. I have looked at correlated subqueries but not sure how the code would work.

Any ideas?

J

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-03-27 : 19:17:17
I don't understand what you want. Could you provide a data example of what will occur?

Tara Kizer
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

yirmyah
Starting Member

2 Posts

Posted - 2007-03-27 : 19:45:22
Sure,

I use a single parameter (i.e. phone number) as input. Upon the execution of the stored procedure, the phone number is checked in a 'master' table.

If the phone number exists in the master, then about 20 parameters are retrieved.

For example, for phone number 12345678 i would retrieve the following (not all 20 parameters as it too much onscreen):

DataA DataB DataC
---------------------------------------
ABC 123 456

Not all phone numbers have data for each of the 20 parameters, but null is returned anyway (which is correct for what i require it for).

I have attempted to build a fact table by using the phone number from the master table as input, but this takes a very long time as this is processing row by row.

I have been told that a set-based correlated subquery would be a better option, but am not sure how to do this.
Go to Top of Page
   

- Advertisement -