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
 How to prompt user and read input

Author  Topic 

tvspsekhar
Starting Member

20 Posts

Posted - 2010-03-25 : 03:37:25
Please give me the syntax to prompt for the user and to read the input.

For example in any select statement for using where clause to give the eno as given by the user.

Select * from employee where eno = ---- It should prompt for the user to enter the eno and then to execute the select statement.

Please help me out.

tvspsekhar

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-25 : 04:05:56
No way in T-SQL.
I think you know that from ACCESS but this isn't possible in T-SQL.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2010-03-25 : 04:22:07
SQL server does not have a front end that the users can interact with. This is usually created in c#/php/access/whatever...

- Lumbago
If the facts don't fit the theory, change the facts. Albert Einstein
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-03-25 : 05:00:30
quote:
Originally posted by tvspsekhar

Please give me the syntax to prompt for the user and to read the input.

For example in any select statement for using where clause to give the eno as given by the user.

Select * from employee where eno = ---- It should prompt for the user to enter the eno and then to execute the select statement.

Please help me out.

tvspsekhar


That is the job of a front end application

Madhivanan

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

tvspsekhar
Starting Member

20 Posts

Posted - 2010-03-25 : 05:56:01
OK. Thank U all.

tvspsekhar
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-03-25 : 06:21:20
The best you can do without a front end is to write a stored proc with paramaters. If you were to right click on the stored proc in management studio it can prompt you for the run time values for parameters.


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -