Re: Project
From: Keith Kratochvil (sqlguy.back2u_at_comcast.net)
Date: 06/10/04
- Next message: K: "RE: help with format file"
- Previous message: Anith Sen: "Re: Correct Syntax"
- In reply to: Jeff Thur: "Project"
- Next in thread: Jeff Thur: "Re: Project"
- Reply: Jeff Thur: "Re: Project"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 10 Jun 2004 15:26:05 -0500
Sure. I don't know what your specific requirements are. Do you want to search for exact strings or LIKE strings? Do you want one stored procedure that will do everything or do you want to create one stored procedure if they are searching for name and one for zip? Is the data that you are looking for stored in one table or is it in multiple tables?
VB, C#, or ASP should work quite nicely for a front end.
I have made some assumptions, but this example (that you can run within Query Analyzer) should get you started:
create table #HoldsYourData (Name varchar(20), Zip varchar(9))
insert into #HoldsYourData (Name, Zip) VALUES ('test', '12345')
insert into #HoldsYourData (Name, Zip) VALUES ('test1', '123457890')
insert into #HoldsYourData (Name, Zip) VALUES ('test2', '23456')
insert into #HoldsYourData (Name, Zip) VALUES ('more', '98765')
insert into #HoldsYourData (Name, Zip) VALUES ('more1', '789018765')
insert into #HoldsYourData (Name, Zip) VALUES ('more2', '789016325')
GO
CREATE PROC FindData
@Input varchar(20),
@type char(1)
AS
IF @type = 'N'
BEGIN
SELECT * FROM #HoldsYourData WHERE Name LIKE @input + '%'
RETURN (0)
END
IF @type = 'Z'
BEGIN
SELECT * FROM #HoldsYourData WHERE Zip LIKE @input + '%'
RETURN (0)
END
GO
--call the stored procedure
EXEC FindData 'test', 'N'
EXEC FindData '789', 'Z'
-- Keith "Jeff Thur" <computercardio@verizon.net> wrote in message news:A6E89F93-420E-41CC-9F81-2BE01C0258B7@microsoft.com... > I have been assigned a project. I am totally new to SQL/VB6.0 > I need to create a lookup scenario for end users to search the database by name or zipcode. > The name or zipcode will change each time the user makes a request from the database. > Since the user will have no knowledge of writting SQL queries, I would like to create a data entry screen for the user to enter the zipcode or name and have the database queried by that input. > Is this something that SQL can handle? > Will an API like Visual Basic combined with SQL handle this task? > Can English Query handle this? > There will only be one table involved in this project. That table will have about 98 columns. > Thanks in advance for any help that you can provide..................
- Next message: K: "RE: help with format file"
- Previous message: Anith Sen: "Re: Correct Syntax"
- In reply to: Jeff Thur: "Project"
- Next in thread: Jeff Thur: "Re: Project"
- Reply: Jeff Thur: "Re: Project"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|