Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a view that asks the user to enter data

Status
Not open for further replies.

MelissaT

Programmer
Joined
May 16, 2002
Messages
67
Location
US
We're just getting into SQL. Took two 1-week courses on it 2 years age, so I'm a bit rusty. I have a Microsoft Access database that I have upsized to a .adp file and linked to the tables on the sql server. Now, all of my queries are gone. I have to create views now, right? How do I create a view that asks the user to enter some data. Example, I want a prompt to come up and ask the user to enter the street name they want to search the database for.
 
With SQL Server you should have gotten Books OnLine (Start>Programs>Microsoft SQL Server> Books OnLine). Refer to Create Procedure.

Basically the syntax is:

CREATE PROCEDURE myprocedurename
@myvariable VARCHAR(30)
AS
SELECT columnname1, columnname2
FROM mytable
WHERE columnname2 = @myvariable

The @myvariable is a variable (or parameter) that allows user input.

This procedure would be run as:

EXEC myprocedurename 'input'

input would be replaced with whatever the user was to input for the search.


-SQLBill

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top