?
Solved

Create sql server view or any other method that accepts parameters

Posted on 2007-10-01
5
Medium Priority
?
2,293 Views
Last Modified: 2012-06-27
Hi..

I am planning to migrate my website which uses the MS ACESS Database to MS SQL Server 2000.
So, I have to move the tables and queries from access db to sql server.
I have no problem moving the tables.

PROBLEM:
I have to move the queries from access db to MS SQL SERVER as views..
The access queries gets a parameter and displays the results.
How do I move this with the same functionality to the SQL SERVER 2000????
0
Comment
Question by:jawahar_prasad
5 Comments
 
LVL 11

Expert Comment

by:Otana
ID: 19996540
You can create stored procedures on SQL Server that accept parameters, you can get a recordset returned from those.
0
 
LVL 23

Expert Comment

by:Ashish Patel
ID: 19996542
NO, views in SQL Server 2000 will not accept parameters so write a general query and then you can add where clause to the view in 2000 whenever you use them.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 19996791
you can create functions or stored procedures to accept parameters.
0
 
LVL 1

Accepted Solution

by:
ICM_IT earned 2000 total points
ID: 19996912
for a procedure:

CREATE PROCEDURE usp_getSelect
@param1 varchar(10) = NULL
@param2varchar(10) = NULL
AS

SELECT * FROM TABLE
WHERE
param1 = @param1 AND
param2= @param2
0
 
LVL 14

Expert Comment

by:Jai S
ID: 19996986
the best bet is to create stored procedures which will accept parameters and perform...
but in case you want to use a repititive query (which will return a scalar value) you can use functions with parameters and a return value...again it all depends on wht you are doing with  your query
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question