Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query asks for information

Author  Topic 

leslieb
Starting Member

23 Posts

Posted - 2008-09-26 : 02:09:11
A normal sort of query could be:

USE PUBS
SELECT *
WHERE PUB_NAME LIKE 'NEW%'


Is there a way to write this so that rather then having the NEW% it prompts the person running the query what information they want? The first person might be after all starting with A and the next time all those with B

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-26 : 02:11:53
You cant make sql server prompt an input from user. You need to do the user interactive part using your front end application using forms and related GUI and send values from user as parameter to sql procedure which uses the passed value and retrieves result from tables.
Go to Top of Page

clarkbaker1964
Constraint Violating Yak Guru

428 Posts

Posted - 2008-09-26 : 02:12:54
sql does not provide interfaces for user input durring run time, you can create a procedure and pass values to the sql statement.

ie.
create procedure usp_newname
@pub_name varchar(255)
as
select * from tblX where pub_name = @pub_name
go


You can do anything at www.zombo.com
Go to Top of Page
   

- Advertisement -