Re: Project

From: Keith Kratochvil (sqlguy.back2u_at_comcast.net)
Date: 06/10/04


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..................


Relevant Pages

  • Re: Invalid authorization specification
    ... > are good enough for Query Analyzer) to no avail. ... > assume that if it couldn't see the server the message ... > doesn't apply to SQL ... >>> ownership chaining has to do with accessing a database ...
    (microsoft.public.sqlserver.security)
  • OUT OF MEMORY
    ... started to work with SQL CE DB. ... We want to create a database in the device and access the records in ... from the CVS file and frame the query then insert them into the table. ... We have done this using the API's and not through the query analyzer. ...
    (microsoft.public.sqlserver.ce)
  • Re: Database file already opened when synchronizing
    ... SQL CE databases are limited to a single open connection at any ... When exiting Query Analyzer, be sure ... In SQL Mobile, multiple connections to the database are supported, so ...
    (microsoft.public.sqlserver.ce)
  • Can I do this with SQL
    ... I need to create a lookup scenario for end users to search the database by name or zipcode. ... 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. ...
    (microsoft.public.sqlserver.programming)
  • Project
    ... I need to create a lookup scenario for end users to search the database by name or zipcode. ... 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. ...
    (microsoft.public.sqlserver.programming)