Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft SQL Server > Anyway to decla...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 11143 of 11517
Post > Topic >>

Anyway to declare and use variables in a View

by mike <mike.a.rea@[EMAIL PROTECTED] > Jun 13, 2008 at 09:03 AM

I have some SQL code I wrote that returns about 15,000 rows (using a
group by statement, raw data is around 1mill rows).  In this code I
have a few variables that I declare and set. These variables for the
most part are just calling functions that return a set value that I
use later in my script in Where statements. The script runs in about
11sec and all the data looks good.

Now I would like to create a view with this script, my ultimate goal
here is to have Excel call the view for an end user that will update
whenever they want.  I want to make it as easy as possible on them.

So my question is, is there any way that I can do this?

Now I can certainly just replace all of my variables.  However because
of the way that SQL works and the way that I have the script
constucted it fires the functions 1 time each then just uses the
result, if I replace all the variables with the functions it has to
fire the functions around 1mill times each.  These functions were
written by someone else and they work but I do find them slow.
Consequently the time to run the script jumps from 11sec to over 15min.
 




 3 Posts in Topic:
Anyway to declare and use variables in a View
mike <mike.a.rea@[EMAI  2008-06-13 09:03:18 
Re: Anyway to declare and use variables in a View
--CELKO-- <jcelko212@[  2008-06-13 09:44:26 
Re: Anyway to declare and use variables in a View
"Plamen Ratchev"  2008-06-13 13:40:18 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 0:51:54 CST 2008.