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
 User Input

Author  Topic 

sambrown180
Starting Member

38 Posts

Posted - 2008-11-26 : 12:47:46
Is it possible to make a query that would require user input? e.g. type a customerID in and return all details of this customer?

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2008-11-26 : 13:07:36
You'll have to use a reporting tool for that and pass parameter to a sql statement. Sql server doesn't provide you this front end feature.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-27 : 04:07:02
You might need to use reporting tool as sakets tld or need to design a form which accepts user input through front end application.
Then grab the input values through parameters and pass them down to sql using stored procedure.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-11-27 : 04:45:42
quote:
Originally posted by sambrown180

Is it possible to make a query that would require user input? e.g. type a customerID in and return all details of this customer?

Possible in ACCESS and not in SQL Server


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2008-11-27 : 05:32:29
You could create an SP with the customer id as a required parameter. This would fail if the user didn't give it a customner id.
e.g.

create proc s_get_cust_details
@customer_id int
as

select *
from customer
where coustomer_id = @customer_id
go

call by

s_get_cust_details 5


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -