Link to home
Start Free TrialLog in
Avatar of DreamMaster
DreamMaster

asked on

Dynamic View?

Hello Experts,

I am building an application that uses SQL Server. Soon this will change to Oracle but that is not my biggest concern. My main concern is about a view.

This view has the following select statement:
Select t$hfdl, t$date, t$wrko, t$beur from ttirbh016700 where t$uitv = 1 and t$afgm = 1 and t$odat <> 0 and t$dctb = 0

The table this is selected from, should be different depending on a value my Visual Basic application reads from an INI file

the '700' part should be dynamic.

I am not the most frequent user of SQL Server or Oracle, but as far as I know, views are static. Anyone that knows a way to pass my INI value to the view? Or am I right and is this simply not possible. If it isn't...what is the way to go? Stored Procedures? Please someone advice..I need this as soon as humanly possible..

Regards,
Max.
SOLUTION
Avatar of imrancs
imrancs
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DreamMaster
DreamMaster

ASKER

Thanks for the quick reply Imran,

The view already exists on the server. I guess it can be altered in the same way...

If I would run this from Visual Basic, where I just run:

com_R5_cmd.CommandText = "SELECT * FROM R5_ONTVANGST"
rst_Triton_Project.Open cmd_R5_cmd.adOpenStatic, adLockBatchOptmistic

I'd have to change that to a stored procedure I call. This stored procedure could then call the information from my INI file and possibly alter my view to the correct one.

I am strongly thinking of changing the views to one stored procedure that has both table name and fields as parameters. Let me try out some options and I will get back to this asap...

Regards,
Max.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That is what I thought rafrancisco. Sadly I cannot test it at this very moment as I do not have the clients database. I will look over the answers given and either split or accept one accordingly...

Thanks you both.. :)

Regards,
Max.
I am going to split points between the two of you...both comments have been helpfull to me...

Regards,
Max.
Glade if I could help.


Imran